Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- content = "<script>" + js_code + "</script>";
- $('#iframe_id').contents().find('body').append(content);
- var script = "alert('hello world');";
- $('#iframe').contents().find('body').append($('<script>').html(script))
- $("#iframe").contents().find("body").append(decodeURI("**%3Cscript%3E** alert(2) **%3C/script%3E**"));
- var scriptTag = "<script>alert(1)<";
- scriptTag += "/script>";
- console.log(scriptTag);
- $("#iframe").contents().find("body").append(scriptTag);
- var scriptTag = "<script>alert(1)</script>";
- $("#iframe").contents().find("body").append(scriptTag);
- function initFrame (code){
- eval (code);
- }
- initFrame.apply ($('#iframe').contents(),[js_code]);
- var initFrame = new Function(js_code);
- initFrame.apply ($('#iframe').contents(),[]);
- <script type="text/javascript" src="/jquery/jquery-ui-1.9.1.custom.js"></script>
- <iframe id="frame"></iframe>
- $("#frame").attr(
- "src", "data:text/html;charset=utf-8," +
- "<html>" +
- "<style>.red {color: red}</style>" +
- "<div class="test">Test</test>" +
- "<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"><" + "/script>" +
- "<script>$(function(){ $(".test").addClass("red")});<" + "/script>" +
- "</html>"
- );
- function putScriptInIframes(script, scriptId) {
- var $iframes = $('iframe');
- $iframes.each(function () {
- var thisDoc = this.contentWindow.document;
- if ( ! thisDoc.getElementById(scriptID)) {
- var scriptObj = thisDoc.createElement("script");
- scriptObj.type = "text/javascript";
- scriptObj.id = scriptId;
- scriptObj.innerHTML = script;
- thisDoc.body.appendChild(scriptObj);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement