Forum Moderators: open

Message Too Old, No Replies

How to detect Google cache

         

kaled

3:05 pm on Oct 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The javascript content of my pages fail when run from the Google cache. Therefore, I wish to be able to detect when a page is being viewed from the cache. Having looked at the source code of the cache header, I noticed that the <BASE> tag is used to set the base url of the page. I thought that I might be able to use it but I can see no way in javascript to read the BASE value.

Does anyone know how to read the BASE value, or know another way to solve this problem?

Kaled.

RonPK

9:29 am on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe it's easier to read the location string and check for the presence of for example "search?q=cache:".

if (location.href.indexOf("search?q=cache:") > -1) {
// do cache-specific things
} else {
// do regular things
}