0

In this page: http://www.depositosalto.com.br/lojas.php, I have a javascript to resize a div and a iframe containing a google maps location. Happens that the javascript is executed only after the iframe is loaded. How I do to the javascript be executed first?

EDIT: The javascript is not to resize the iframe, but another div with the content with id = "conteudo".

2 Answers 2

1

You can calculate the proper size of the IFRAME and then generate the IFRAME tag using JavaScript. This will guarantee that your IFRAME will appear only after JS code executed.

P.S. Use tag to make sure that people who has JavaScript turned off will still see the IFRAME with Google Map.

Sign up to request clarification or add additional context in comments.

3 Comments

The script is not to resize the iframe, but another div in the page.
It actually does not matter (DIV of IFRAME) you can still generate it using JS and perform calculation of the size prior to that.
I using this solution now. Thanks.
1

Use the <body onload: > option. This triggers when the page is first loaded.

2 Comments

You can see some non library dependent code here: stackoverflow.com/questions/1206937/javascript-domready
Currently I using body onload.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.