I have an advertisement JS code installed on my forum, and I want it to be loaded after the forum has been fully loaded, How to do that?
This is the JS code:
<script type="text/javascript" language="javascript" src="http://adv.sitemarketing.sa/components/com_adagency/ad_agency_zone.php?zid=261"></script>
I have five of them.
Just add the JS at the bottom close to </body>
.
<script type="text/javascript" language="javascript" src="http://adv.sitemarketing.sa/components/com_adagency/ad_agency_zone.php?zid=261"></script>
This is the way Bootstrap loads js.
You can try to add script after page is loaded:
<script type="text/javascript">
function downloadJS() {
var element = document.createElement("script");
element.src = "http://adv.sitemarketing.sa/components/com_adagency/ad_agency_zone.php?zid=261";
document.body.appendChild(element);
}
if (window.addEventListener) {
window.addEventListener("load", downloadJS, false);
} else if (window.attachEvent) {
window.attachEvent("onload", downloadJS);
} else window.onload = downloadJS;
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.