-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DEV mode on Safari when view transitioning to client:only components #9000
Conversation
🦋 Changeset detectedLatest commit: e3d3345 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like Safari is doing it for security reasons. The workaround for now looks good to me though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You asked for a suggestion, and I gave you one! 🙌
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested manually, works great! Thanks a lot for the weekend fix!
@lilnasy thanks for the hint about Webkit under Windows ;-) Otherwise I wouldn't have had a chance! |
…nts (#9000) * Fix DEV mode on Safari when view transitioning to client:only components * Update .changeset/eighty-ladybugs-shake.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Changes
Closes #8988
Currently, "iframe.srcdoc" is not equally well supported by all browsers. At least I have not yet found a way that works with the import resolution of Safari. However, it works well with Firefox and Chrome. With great regret I have changed
srcdoc
back tosrc
.Details
Falling back to
src
is not my favorite approach: the reason for usingsrcdoc
was that we can render the possibly modified in-memory version of newDocument, not the file provided by the server.The reason srcdoc doesn't work on webkit browsers is that srcdoc changes the
documentURI
toabout:srcdoc
, which leads to errors when resolving absolute URLs with no origin. (All browsers setabout:srcdoc
in this way, but the others seem to have special cased the resolution)I've tried to fix this by rewriting URLs starting with
"/"
to"http://..."
, using the actuallocation.origin
from the main document or setting<base>
for theiframe.contentDocument
, but I've had no success so far.If anyone knows a way to use
srcdoc
across browsers without errors, I would be happy to hear about it :)We could POST the HTML of the newDocument to the DEV server and GET it back for the
src
attribute.Testing
Tested manually with Webkit on Windows.
Docs
n/a, bug fix
Always happy about better .changeset wording