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.

alternative jquery attr() in ie?

attr() not working in ie

jquery attr() not work in ie

for security reasons, data uris restricted downloaded resources.
data uris cannot used navigation, scripting, or populate frame or iframe elements.

msdn

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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -