Note: You must be registered in order to post a reply. To register, click here. Registration is FREE! Before posting, make sure you have read this topic!
T O P I C R E V I E W
Webbo
Posted - 21 June 2015 : 13:22:07 Is it possible to add a snippet of code to an <!--#INCLUDE FILE="myfile.asp"--> so that it loads after the rest of the page has loaded, and if so what would it be?
The issue is I use adserving software to place banner adverts within my forum pages and the code for the banner zones is added where required using includes and separate files. Occasionally if a banner is slow to load it holds up the rest of the page until it has done so. If I could add a snippet of code to tell the forum software not to load the include file until the rest of the page has loaded then this would resolve the problem - I think
Thanks
6 L A T E S T R E P L I E S (Newest First)
ruirib
Posted - 24 June 2015 : 08:30:04
quote:Originally posted by Webbo
It basically sets the zone for the banner advert and calls the relevant banners for that zone.
Looking into JQuery there seems to be an issue using it and document.write if I've interpreted what I've read correctly :)
It's a shame that we cant use a <!--#INCLUDE FILE_After_everything_else="myfile.asp"--> command
If it sets the zone for adverts, it doesn't need to be called in that area of the page. It can be called, anywhere, I would think?
document.write can be easily replaced by something that would work on jQuery's document.ready. Examples given here:
With .append, for example, it seems easy to load whatever you want, wherever you want it and then execute it after the page has loaded.
Webbo
Posted - 24 June 2015 : 02:16:59 It basically sets the zone for the banner advert and calls the relevant banners for that zone.
Looking into JQuery there seems to be an issue using it and document.write if I've interpreted what I've read correctly :)
It's a shame that we cant use a <!--#INCLUDE FILE_After_everything_else="myfile.asp"--> command
ruirib
Posted - 24 June 2015 : 00:26:08 It's not immediately clear to me what that piece of javascript is doing, other than generating another piece of javascript. With the available info, I am not sure what I described would be possible.
Webbo
Posted - 23 June 2015 : 15:46:07 Hi Rui,
There are three includes altogether, one to place a banner in the header of the site, one to place banners within topic.asp and one to place a banner in the footer
As an example the include file for the header contains the following code:
Posted - 21 June 2015 : 23:42:02 In principle, what you could do is use jQuery to load the contents asynchronously and then add them to the part of the page you want. It's actually quite easy to do and you can do it by adding the javascript do it, at the bottom of the page, which means the page would load fully without being interrupted by the part loaded by the jQuery. Basically this would mean that the banner would have to be loaded by jQuery and thus the include file would probably be ditched.
In order to understand if this is actually possible in your case, it would be needed to know what you load with the include file and it's possible that some small changes need to be done to the page that loads the banners, so that you can have some element that you can use to add whatever will be retrieved through jQuery.
Carefree
Posted - 21 June 2015 : 21:52:58 Not possible. Include files are loaded before any of the script is executed. Your only solution is to minimize either the resolution or the size of the banner(s).