Mesut Başaran
Mesut Başaran

Reputation: 977

Load script after all elements has loaded

I have a web page and it takes weather information from another service.But sometimes the service not responding and slow downs the page loading.

I want to load this weather script after all the elements has loaded in this page.

This is my script

"<script type='text/javascript' language='javascript' src='http://www.havadurumux.com/api.php?dcr=%23eeeeee&apr=%23eeeeee&icr=%23eeeeee&ikap=%23eeeeee&fr=%23000000&br=%23eeeeee&dr=%233570a9&wt=tekli&cityurl=36'/>"

I want to write it into a html elemnt which is located in a specific place after page load.

How can i do this ?

Thank you very much

Upvotes: 0

Views: 250

Answers (1)

Shashank
Shashank

Reputation: 399

Place your script at bottom of the page after body tag. In this way your script will be called after all HTML has been loaded. Hope this can solve your issue.

<body>
....
</body>
<script type='text/javascript' language='javascript' src='http://www.havadurumux.com/api.php?dcr=%23eeeeee&apr=%23eeeeee&icr=%23eeeeee&ikap=%23eeeeee&fr=%23000000&br=%23eeeeee&dr=%233570a9&wt=tekli&cityurl=36'/>
</html>

Upvotes: 1

Related Questions