Log in

View Full Version : Cache page in background?



DarkDove
09-19-2012, 05:12 PM
I am making a page for our alliance in a game http://fukabam.com But I have 2 smaller issues I would like to ask for help on.

1. When the index page loads up, sometimes it is a little too fast running the script that creates the grey box around the text/banners, ending up with the lower KoC banner down in the black area instead of inside the box. Is it possible to cache that banner so its loaded in memory before the js script pushes it out?

2. Click on the "Members" button, this page loads an external page, that works very slow because it gets information from inside of the game, is there any possible way to cache this site, maybe in the background once people are on our page, or by a script that runs on every visit, and perhaps holds an older version of the kocmon page? (we dont need it to be the "real" page, because that page is on a delay of its own and not 100% accurate anyway)

bernie1227
09-19-2012, 09:11 PM
for the first one, try triggering the gray borders script onload for the banner.

jscheuer1
09-23-2012, 05:21 PM
The only thing I can think of for that would be to have an iframe on the page. Give it style, dimensions like width: 1px; height: 1px; and visibility: hidden;. Make it's src attribute the page that you want to preload.

molendijk
09-23-2012, 10:18 PM
The only thing I can think of for that would be to have an iframe on the page.
Yes, something like this:

<iframe name="preload" style="position: absolute; display: none; left: -10000px" onload="if(frames.preload.location.href!='about:blank'){parent.location.href=frames.preload.location.href}"></iframe>
<a href="javascript: void(0)" onclick="frames.preload.location.replace('some_page.html'); return false">go to some page.html</a>
Works only for pages belonging to your own domain.

jscheuer1
09-24-2012, 12:21 AM
I'd go for something more straightforward, like:


<iframe name="preload" style="position: absolute; visibility: hidden; left: -10000px;" src="pagetopreload.htm"></iframe>

I'd use visibility: hidden; instead of display: none; because that's more likely to allow full preloading of the page.

And doing it with the src attribute already set allows you to preload a page from any domain as long as it doesn't break out of or deny display in frames.

molendijk
09-24-2012, 09:01 AM
I'd go for something more straightforward, like:

<iframe name="preload" style="position: absolute; visibility: hidden; left: -10000px;" src="pagetopreload.htm"></iframe>
Yes, but that I was thinking of a general way of preloading any 'non-foreign page' by clicking on a link of the navigation menu.
I agree on what you say about visibility.
Arie.