javascript - Why does not jQuery .attr() work in IE9? -
the following code combination of html, css , javascript "injected" existing iframe ('iframe_id'). although following code works firefox, chrome , safari, not work in ie9. checked of related , existing answers, , of them related issues in ie8 or older, not in case. related jquery .attr()? ie9 have issues (like older ie versions)? if yes, how can fix it?
$("#iframe_id").attr( "src", "data:text/html;charset=utf-8," + "<!doctype html>"+ "<html>"+ "<head>"+ "<style>"+ "/********** css stuff here **********/"+ "</style>"+ "</head>"+ "<body>"+ "<!--------- html stuff here ---------->"+ "<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"><" + "/script>" + "<script>"+ "/*********** jquery stuff here *****/"+ "<" + "/script>"+ "</body>"+ "</html>" );
in ie9, typical "the webpage cannot displayed..." error.
i reviewed following answers, did not help.
for security reasons, data uris restricted downloaded resources.
data uris cannot used navigation, scripting, or populate frame or iframe elements.
this goes versions of internet explorer.
to working, can do:
var html = "<!doctype html>"+ "<html>"+ "<head>"+ "<style>"+ "/********** css stuff here **********/"+ "</style>"+ "</head>"+ "<body>"+ "<!--------- html stuff here ---------->"+ "<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"><" + "/script>" + "<script>"+ "/*********** jquery stuff here *****/"+ "<" + "/script>"+ "</body>"+ "</html>"; var frame = document.getelementbyid('iframe_id'); frame.contentwindow.document.write(html);
Comments
Post a Comment