delete cache

Just starting out? Need help? Post your questions and find answers here.
Stefan
Posts: 160
Joined: Mon Feb 05, 2018 9:44 pm

delete cache

Post by Stefan »

Can I use Spiderbasic to delete the cache of the browser and the cache of the images in the browser?
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: delete cache

Post by Peter »

Stefan wrote:Can I use Spiderbasic to delete the cache of the browser and the cache of the images in the browser?
untested:
[b]Kevin Hakanson on StackOverflow[/b] wrote:You can call window.location.reload(true) to reload the current page. It will ignore any cached items and retrieve new copies of the page, css, images, JavaScript, etc from the server. This doesn't clear the whole cache, but has the effect of clearing the cache for the page you are on.

Code: Select all

! window.location.reload(true);
Stefan
Posts: 160
Joined: Mon Feb 05, 2018 9:44 pm

Re: delete cache

Post by Stefan »

Where does the code go? No matter where I insert it, I get an endless loop and the page reloads again and again.
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: delete cache

Post by Peter »

Stefan wrote:Where does the code go? No matter where I insert it, I get an endless loop and the page reloads again and again.
Put it into a procedure and call it, when a button is clicked (for example)
Stefan
Posts: 160
Joined: Mon Feb 05, 2018 9:44 pm

Re: delete cache

Post by Stefan »

Okay,thank you, but that's not what i wanted. I would like a page to run automatically without considering the page's cache and the image cache. Is this possible?
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: delete cache

Post by Peter »

Is there a particular reason for this need?

You can try to use my HtmlPreprocessor to inject the following lines into the head-section of the SpiderBasic index.html - File

Code: Select all

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
Stefan
Posts: 160
Joined: Mon Feb 05, 2018 9:44 pm

Re: delete cache

Post by Stefan »

Unfortunately none of this works.
I have a homepage that constantly changes the pictures, but the names of the pictures remain the same. And so the browser does not load the new pictures because it still has the old pictures in the cache.
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: delete cache

Post by Peter »

then try the following::

Code: Select all

LoadImage(#YourImage, "[SomePath]/YourImage.png?rnd=" + ElapsedMilliseconds())
Stefan
Posts: 160
Joined: Mon Feb 05, 2018 9:44 pm

Re: delete cache

Post by Stefan »

Unfortunately I dont understand what you mean.
I load a picture in this way:

Code: Select all

 LoadImage(#mypic,"myfolder/mypic17.jpg")
On wihich way I shoult load mypic17.jpg now?
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: delete cache

Post by Peter »

Code: Select all

LoadImage(#mypic,"myfolder/mypic17.jpg?rnd=" + ElapsedMilliseconds())
Post Reply