javascript - Add contents to an empty frame -


i have empty frame in page, src set '' (empty). have string this:

<html>   <head>     <base src="http://www.example.com">     <title>blah</title>   </head>   <body>     <p>fancy web page</p>   </body> </html> 

i populate iframe string, exact content of matches string.

what's best way this? going insane trying it.

you need set id on iframe , set innerhtml of iframe's document body , head head/body string values.

here's working fiddle: http://jsfiddle.net/theoutlander/dw3r7/1/

<iframe id=testframe></iframe>  var strhead = '<base src="http://www.example.com"><title>blah</title>' var strbody = '<p>fancy web page</p>';  testframe.document.head.innerhtml = strhead; testframe.document.body.innerhtml = strbody; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -