I got error if want to use Xpra html5 inside iframe element:
Uncaught DOMException: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
Browser stopped, nothing to see. It appears in file 'Utilities.js', about in 436 line. If I catch error then everything works normally. So, the modification looks:
var value = getParameter(prop); try { if (value === undefined && typeof(sessionStorage) !== undefined) value = sessionStorage.getItem(prop); } catch (e) { // nothig to catch } return value;
I use Debian Stretch packages for version 2.4.3.
'nothig to catch' is a comment.
I would expect the connect page to also produce errors with sessionStorage
access.
In which case you won't be able to pass settings to the index page.
As per sessionStorage in iframe, you can use the sessionStorage
if the client runs from the same domain. Maybe you can do that instead?
I cannot run xpra html5 in the same domain. What do you think about this solution: https://michalzalecki.com/why-using-localStorage-directly-is-a-bad-idea/
Using in-memory storage won't work across pages.
r21499 does merge the more thorough test for sessionStorage
, so we won't try to use it when it is defined but not usable (ie: because of chrome content settings).
In most cases, using URI will work the same as sessionStorage
- just exposing all the settings in the URL bar, but you will not be able to use the password field of the connect page without also agreeing to use Insecure plain-text passwords settings.
Please close if that works for you.
Oops, you also need the r21500 fixup.
You can also change 439 line in Utilities.js from
if (value === undefined && typeof(sessionStorage) !== undefined) {
to
if (value === undefined && Utilities.hasSessionStorage()) {
If you do so, xpra html5 now works in iframe without error. You may now close this ticket.
I've gone for a slightly different solution in r21506.
Your solution does not work because the error is still present in line 439. So move line 439 in below try/catch block.
Example:
value = sessionStorage.getItem(prop); try { if (value === undefined && typeof(sessionStorage) !== undefined) { value = sessionStorage.getItem(prop); } } catch (e) { value = null; } return value;
I don't understand why javascript would throw an exception running typeof(sessionStorage)
, but whatever, merged in r21519.
What is the error that you saw?
Replying to Antoine Martin:
I don't understand why javascript would throw an exception running
typeof(sessionStorage)
, but whatever, merged in r21519. What is the error that you saw?
Uncaught DOMException: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
Ah, thanks, got it.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2123