Closed msurguy closed 9 years ago
Which browser did you figure out this problem? On May 21, 2015 23:42, "Maksim Surguy" notifications@github.com wrote:
This will prevent the script from breaking since </script makes browsers think that this is the end of the whole script, thus rendering anything
after the script closing tag as plain HTML instead.
You can view, comment on, or merge this pull request online at:
https://github.com/wandenberg/nginx-push-stream-module/pull/183 Commit Summary
- Replace < with equivalent html entity
File Changes
- M misc/js/pushstream.js https://github.com/wandenberg/nginx-push-stream-module/pull/183/files#diff-0 (2)
Patch Links:
- https://github.com/wandenberg/nginx-push-stream-module/pull/183.patch
- https://github.com/wandenberg/nginx-push-stream-module/pull/183.diff
— Reply to this email directly or view it on GitHub https://github.com/wandenberg/nginx-push-stream-module/pull/183.
I am seeing this in Chrome (latest version, Mac OS) and on Safari mobile iOS (iOS 7).
Can you send me a step by step with how to reproduce the problem?
@wandenberg yes. If the current JS script is placed inside of "body" tag of an iFrame. For example if you try to demo your app on Bootsnipp.com or on Codepen.io: http://bootsnipp.com/snippets/55WAX (using current JS) vs http://bootsnipp.com/snippets/lWjP0 (using my updated JS), http://codepen.io/msurguy/pen/ZGyoeJ (using current JS) vs http://codepen.io/msurguy/pen/doRevw (using the last method in this comment).
Here's the explanation why use that instead: http://stackoverflow.com/questions/8231048/why-use-x3c-instead-of-when-generating-html-from-javascript
Another alternative is to break up the string with JS in the following manner:
transferDoc.write("<"+"html>"+"<"+"script>document.domain='" + document.domain + "';"+"<"+"/script>"+"<"+"body>"+"<"+"iframe id='" + this.iframeId + "' src='" + url + "'>"+"<"+"/iframe>"+"<"+"/body>"+"<"+"/html>");
Thanks @wandenberg !
This will prevent the script from breaking since
</script
makes browsers think that this is the end of the whole script, thus rendering anything after the script closing tag as plain HTML instead.