Created
May 13, 2015 14:53
-
-
Save JasonBarnabe/74dff6c3f89d439b741e to your computer and use it in GitHub Desktop.
stylish iframe test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script> | |
<!-- | |
// Content is code at http://ace.c9.io/#nav=embedding | |
iframeContent = '<!DOCTYPE html>\n<html lang="en">\n<head>\n<title>ACE in Action</title>\n<style type="text/css" media="screen">\n #editor { \n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n</style>\n</head>\n<body>\n\n<div id="editor">function foo(items) {\n var x = "All this is syntax highlighted";\n return x;\n}</div>\n \n<script src="http://ace.c9.io/build/src/ace.js" type="text/javascript" charset="utf-8"></script>\n<script>\n var editor = ace.edit("editor");\n editor.setTheme("ace/theme/monokai");\n editor.getSession().setMode("ace/mode/javascript");\n</script>\n</body>\n</html>'; | |
iframeDataUri = 'data:text/html;charset=utf-8,<%21DOCTYPE%20html>%0D%0A<html%20lang%3D"en">%0D%0A<head>%0D%0A<title>ACE%20in%20Action<%2Ftitle>%0D%0A<style%20type%3D"text%2Fcss"%20media%3D"screen">%0D%0A%20%20%20%20%23editor%20%7B%20%0D%0A%20%20%20%20%20%20%20%20position%3A%20absolute%3B%0D%0A%20%20%20%20%20%20%20%20top%3A%200%3B%0D%0A%20%20%20%20%20%20%20%20right%3A%200%3B%0D%0A%20%20%20%20%20%20%20%20bottom%3A%200%3B%0D%0A%20%20%20%20%20%20%20%20left%3A%200%3B%0D%0A%20%20%20%20%7D%0D%0A<%2Fstyle>%0D%0A<%2Fhead>%0D%0A<body>%0D%0A%0D%0A<div%20id%3D"editor">function%20foo%28items%29%20%7B%0D%0A%20%20%20%20var%20x%20%3D%20"All%20this%20is%20syntax%20highlighted"%3B%0D%0A%20%20%20%20return%20x%3B%0D%0A%7D<%2Fdiv>%0D%0A%20%20%20%20%0D%0A<script%20src%3D"http%3A%2F%2Face.c9.io%2Fbuild%2Fsrc%2Face.js"%20type%3D"text%2Fjavascript"%20charset%3D"utf-8"><%2Fscript>%0D%0A<script>%0D%0A%20%20%20%20var%20editor%20%3D%20ace.edit%28"editor"%29%3B%0D%0A%20%20%20%20editor.setTheme%28"ace%2Ftheme%2Fmonokai"%29%3B%0D%0A%20%20%20%20editor.getSession%28%29.setMode%28"ace%2Fmode%2Fjavascript"%29%3B%0D%0A<%2Fscript>%0D%0A<%2Fbody>%0D%0A<%2Fhtml>'; | |
l = document.body.appendChild(document.createElement('iframe')); | |
d = l.contentDocument; d.open(); d.write(iframeContent); d.close(); | |
// 3: src=''; documentURI='http://ace.c9.io/#nav=embedding' | |
// Stylish=yes styled=yes | |
l = document.body.appendChild(document.createElement('iframe')); | |
l.src = ""; | |
d = l.contentDocument; d.open(); d.write(iframeContent); d.close(); | |
// 4: src='http://ace.c9.io/'; documentURI='http://ace.c9.io/#nav=embedding' | |
// Stylish=yes styled=yes | |
l = document.body.appendChild(document.createElement('iframe')); | |
l.src = 'javascript:""'; | |
d = l.contentDocument; d.open(); d.write(iframeContent); d.close(); | |
// 5: src='javascript:""'; documentURI='http://ace.c9.io/#nav=embedding' | |
// no Stylish styled=no | |
l = document.body.appendChild(document.createElement('iframe')); | |
l.src = iframeDataUri; | |
d = l.contentDocument; d.open(); d.write(iframeContent); d.close(); | |
// 6: src='data:text/html...'; documentURI='http://ace.c9.io/#nav=embedding' | |
// Stylish=yes styled=yes | |
l = document.body.appendChild(document.createElement('iframe')); | |
l.srcdoc = iframeContent; | |
// 7: src=''; documentURI='about:srcdoc' | |
// Stylish=yes styled=no | |
l = document.body.appendChild(document.createElement('iframe')); | |
d=document.implementation.createHTMLDocument('Editor IFRAME') | |
d.open(); d.write(iframeContent); d.close(); | |
d2 = l.contentDocument; | |
d2.replaceChild(d2.adoptNode(d.documentElement), d2.documentElement); | |
// 8: src=''; documentURI='about:blank' | |
// Stylish=yes styled=no | |
l = document.body.appendChild(document.createElement('iframe')); | |
l.src = 'gardez:l.eau'; | |
d = l.contentDocument; d.open(); d.write(iframeContent); d.close(); | |
// 9: src='gardez:l.eau'; documentURI='http://ace.c9.io/#nav=embedding' | |
// Stylish=yes styled=yes | |
l = document.body.appendChild(document.createElement('iframe')); | |
l.src = '#'; | |
d = l.contentDocument; d.open(); d.write(iframeContent); d.close(); | |
// 10: src='http://ace.c9.io/#'; documentURI='http://ace.c9.io/#nav=embedding' | |
// Stylish=yes styled=yes | |
var f,ff = document.querySelectorAll('iframe'); | |
for (var s="",i=0; f=ff[i++];) { | |
s += i + ": src='" + f.src + "'; documentURI='"; | |
try { s+=f.contentDocument.documentURI } catch(e) {s+="[blocked]"} | |
s+="'\n"; | |
} | |
--> | |
</script> | |
<iframe src="http://avclub.com"></iframe> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment