How to empty browser cache
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 77
- Joined: Mon Jul 07, 2008 1:22 am
- Location: Brisbane, Queensland
How to empty browser cache
I am attempting to use Livecode to learn web programming by writing a web application. I can set up file saving and editing with a pre-prepared glossary in Livecode. I am quite new to web programming so I am writing HTML, CSS and JS almost line by line which I need to test as I go. Livecode, of course, provides a very convenient environment for the manipulation of these files. I have been using the built-in browser to view the output.
However, I cannot find a way of clearing the browser cache so that I can see the changes made to the source file for the web application. The cache is clearly an attribute of the browser window but I do not know to access end destroy its contents. The cachedURLs function returns empty yet the browser goes back to the first opened version of the file, not the altered version.
I am on a Mac. The work around at the moment is to default to Safari with the development menu and empty the cache manually - ugh.
Does anyone know how the browser cache can be emptied via script in Livecode?
However, I cannot find a way of clearing the browser cache so that I can see the changes made to the source file for the web application. The cache is clearly an attribute of the browser window but I do not know to access end destroy its contents. The cachedURLs function returns empty yet the browser goes back to the first opened version of the file, not the altered version.
I am on a Mac. The work around at the moment is to default to Safari with the development menu and empty the cache manually - ugh.
Does anyone know how the browser cache can be emptied via script in Livecode?
-
- Livecode Opensource Backer
- Posts: 9386
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to empty browser cache
That is a bit odd.I am attempting to use Livecode to learn web programming by writing a web application.
LiveCode's strengths lie in building desktop (and handheld) apps.
Re: How to empty browser cache
Check out UNLOAD in the LC dictionary. I use it in desktop apps to clear the cache of previously downloaded web files accessed by my app.
Hope that works for you.
-- Tom Bodine
Hope that works for you.
-- Tom Bodine
-
- VIP Livecode Opensource Backer
- Posts: 77
- Joined: Mon Jul 07, 2008 1:22 am
- Location: Brisbane, Queensland
Re: How to empty browser cache
Hi Tom
"Unload" only works for items to which the "Load" command has been applied (I checked "Unload" thoroughly prior to the post). It does not work for web pages placed in the browser ie. I can have a page displayed in the browser and at the same time the "cachedURLs" function returns empty. I can send a different page to the browser and have it display, make a change to the source of the first page, resend the first page to the browser but the display changes to the cached version of the first page, not the new version. It is the cache that the browser uses under these circumstances that I would like to access and empty but I do not know how. The only way to empty it that I have found is to quit livecode - not very practical.
There is a setting in Safari preferences that empties the cache so that the new version loads every time. This works but it is not as neat as being able to everything within livecode.
Hi richmond62
Not that odd really. Since I have been writing applications in hypercard, metacard, rev and now livecode for a long period of time, what better place to write an application (for my own use now that I am retired) which facilitates dealing with the arcane mess that is HTML, CSS and JS. There are some excellent editors (Atom for example) but I cannot tweak them to do all of the things I want in the way that I can with livecode. After 35 years programming in this environment (but never for the web) I think I have become familiar with livecode's strengths and weaknesses. Do you have any suggestions for solving the problem?
"Unload" only works for items to which the "Load" command has been applied (I checked "Unload" thoroughly prior to the post). It does not work for web pages placed in the browser ie. I can have a page displayed in the browser and at the same time the "cachedURLs" function returns empty. I can send a different page to the browser and have it display, make a change to the source of the first page, resend the first page to the browser but the display changes to the cached version of the first page, not the new version. It is the cache that the browser uses under these circumstances that I would like to access and empty but I do not know how. The only way to empty it that I have found is to quit livecode - not very practical.
There is a setting in Safari preferences that empties the cache so that the new version loads every time. This works but it is not as neat as being able to everything within livecode.
Hi richmond62
Not that odd really. Since I have been writing applications in hypercard, metacard, rev and now livecode for a long period of time, what better place to write an application (for my own use now that I am retired) which facilitates dealing with the arcane mess that is HTML, CSS and JS. There are some excellent editors (Atom for example) but I cannot tweak them to do all of the things I want in the way that I can with livecode. After 35 years programming in this environment (but never for the web) I think I have become familiar with livecode's strengths and weaknesses. Do you have any suggestions for solving the problem?
Re: How to empty browser cache
I have heard of a trick (I can't remember who should be credited, I have a vague recollection of seeing it on the mailing list) to force a refreshed view of a revisited page by appending a fake anchor point to the url, using the milliseconds as the anchor ref.
thewebsite.com/content.php#123457 should display the current content of thewebsite.com/content.php in preference to what might have been cached when thewebsite.com/content.php#123456 was visited.
thewebsite.com/content.php#123457 should display the current content of thewebsite.com/content.php in preference to what might have been cached when thewebsite.com/content.php#123456 was visited.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to empty browser cache
I was just going to suggest the same thing. I generally use a "query" construct on the theory it's more likely to force a reload :
www.domain.com/page.html?s=128394i7282
It doesn't matter what's in the query string as long as it's unique to the session. The seconds is convenient for that. The idea is to trick the browser into thinking it needs to fetch an updated copy because the URL is new.
www.domain.com/page.html?s=128394i7282
It doesn't matter what's in the query string as long as it's unique to the session. The seconds is convenient for that. The idea is to trick the browser into thinking it needs to fetch an updated copy because the URL is new.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 77
- Joined: Mon Jul 07, 2008 1:22 am
- Location: Brisbane, Queensland
Re: How to empty browser cache
Thank you Sparkout and Jacqueline. I'll try this and see how I get on.
Cheers
Alex
Cheers
Alex