-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Add support for IE 11 for markup slices #3702
Conversation
…ces. Add allow-top-navigation and allow-popups to support links within iframes
@@ -23,9 +24,11 @@ function markupWidget(slice, payload) { | |||
<iframe id="${iframeId}" | |||
frameborder="0" | |||
height="${slice.height()}" | |||
sandbox="allow-scripts"> | |||
sandbox="allow-same-origin allow-scripts allow-top-navigation allow-popups"> |
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.
Do we really need the allow-top-navigation allow-popups
part?
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.
These are to fix #3672. When the markup slice was moved to use iframe, any link inside the slice would only open within the slice and links meant to be opened in another tab/window did nothing.
We use this for documentation and referencing other sites.
allow-top-navigation
lets users create a link withtarget="_top"
that will open the link in the same taballow-popups
lets users create a link withtarget="_blank"
that will open the link in a new tab
Without these two fields links will only open inside the iframe itself
</iframe>`); | ||
$('#' + iframeId)[0].srcdoc = html; | ||
|
||
const iframe = $('#' + iframeId)[0]; |
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.
indentation is off and while we are at it we may just use a plain dom js function instead of jquery
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.
jquery is now removed
* Add srcdoc-polyfill tosupport Internet Explorer iframes in markup slices. Add allow-top-navigation and allow-popups to support links within iframes * Remove jquery from markup.js
allow-top-navigation
andallow-popups
to support links within iframes: URL link to parent or blank does not work within Markup or Separator widget #3672Because srcdoc-polyfill uses a
javascript:
URL for thesrc
attribute, theallow-scripts
andallow-same-origin
sandbox options need to be set, otherwise Internet Explorer will not be able to execute the script. This technically breaks all sandboxing as any javascript within the iframe can now manipulate the iframe element itself as well as any other element on the page.Added
allow-top-navigation
to support links in the markup slice withtarget="_top"
Added
allow-popups
to support links in the markup slice withtarget="_blank"