Created
March 8, 2013 09:58
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
// http://localhost/test.html | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
function read() { | |
var txtFile = new XMLHttpRequest(); | |
txtFile.open("GET", "http://localhost/test.txt",true); | |
txtFile.onreadystatechange = function () { | |
if (txtFile.readyState === 4) { | |
// Makes sure the document is ready to parse. | |
if (txtFile.status === 200) | |
{ | |
var alltext=txtFile.responseText; | |
var linetext=txtFile.responseText.split("\n"); | |
var delimeter = '^'; | |
var text0= linetext[0]; | |
var splitted = text0.split(delimeter); | |
console.log(splitted[1]); | |
$('#iframe1').attr('src', splitted[1]); | |
} | |
} | |
} | |
txtFile.send(null) | |
} | |
$(function(){ | |
read(); | |
}); | |
</script> | |
<iframe id="iframe1" src="" /> | |
</body></html> | |
// http://localhost/test.txt | |
Site1^https://www.google.ro/ | |
// RESULT | |
1. Iframe's SRC | |
alert(document.getElementById("iframe1").src) => 'https://www.google.ro/' | |
2. Console error (see http://en.wikipedia.org/wiki/Same_origin_policy) | |
Load denied by X-Frame-Options: https://www.google.ro/ does not permit cross-origin framing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment