0

How can we set html contents into an Iframes body, instead of call a url of a page by its src attribute? Note: I want a perfect code, i mean that should able to work in all browsers.

Dani
  • 1
  • 3
  • Please post what you've tried. – Mihai Alexandru-Ionut Jan 21 '17 at 10:56
  • Welcome to SO. Please visit the [help] to see how and what to ask. Asking for "perfect code" does not work at SO. Post what you did and we may help. However I strongly suggest you google first and if you did, post why the code you found does not help. Also explain why you want an iFrame when jQuery can `.load()` a div with contents from the same site – mplungjan Jan 21 '17 at 11:00
  • Use srcdoc property of iframe.http://webdesign.about.com/od/html5tags/p/srcdoc – Kalyan Jan 21 '17 at 11:07

1 Answers1

0

<iframe src="iframe.htm" name="iframe_a">
</iframe>

<a href="http://stackoverflow.com" target="iframe_a">stackExchange</a>
Hemant
  • 1,961
  • 2
  • 17
  • 27