0
votes

I need to set the HTML to iFrame. (iFrame src is null.) e.g I get following string from web method call: string s =

  <html>
  <head>
  <style type="text/css"> <!-- .some dynamicaly generated css> </style>
  <link id="css1" type="text/css" rel="stylesheet" href="1.css" /></head>

  <body style="padding:0; margin:0;" tabIndex="-1">
--- some HTML elements ------           
  <script type="text/javascript">
---some script ---
  </script>
  </body>
  </html>

I need to set this string into iFrame. But when I use iframe.innerHTML it strips out head and body tags.

Can you please help me in this? Do I need to add something to string or add some property to iframe.

Thanks in advance.

1
Why do you want this anyway? Can't you just a src to the iframe and load the content from a file/script? - yunzen
i can not use src because cross-domain issue.. - prasad mandore
Then do you have the right to show the video, if it is not on your domain? - yunzen

1 Answers

0
votes

Why don't you you use jquery?, it will be more easer.

You just can var innerHtml = $( 'Your html' );

and then user function called $.html( innerHtml );