Ask Your Question
2

How can one load Iframe content when the page loads?

asked 2023-03-26 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-02-17 16:00:00 +0000

djk gravatar image

One way to load Iframe content when the page loads is by setting the "src" attribute of the Iframe element to the URL of the content that you want to load. For example, if the Iframe is located in the HTML code like this:

<iframe id="myIframe"></iframe>

Then you can use JavaScript to set the "src" attribute to the URL of the content:

var iframe = document.getElementById("myIframe");
iframe.src = "http://www.example.com/content.html";

This code should be placed in a script tag in the head or body section of the HTML code. When the page loads, the Iframe will automatically load the content specified in the "src" attribute.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-03-26 11:00:00 +0000

Seen: 21 times

Last updated: Feb 17 '23