I have a svery simple requirement. I have a <div>
tag within which I am displaying some text content.
I want to display the same text content in an <iframe>
. What I am trying to achieve I have written below. Can anyone please help?
<b>
<div>This is a content which I want to display in iframe</div>
<iframe id="iframe" src=""></iframe></b>
If it is a static HTML site, create a new page with the content which you want to show and set the
src
of the<iframe>
.If it is a dynamic page app (server side), create a
new page
orhandler
orcontroller
(whatever applies) and set thesrc
of the<iframe>
.These are the best and simplest ways to achieve what you want to accomplish.
Found one more thing which is related to iframe which I think is interesting. You can auto fix the height and width of the
iframe
according to the content of the window. All you need to do is to include the script written below and just pass theid
of theiframe
.