Get last visited site in another window using Javascript

I'm making a Firefox extension where I need to figure out what was last visited in another window. Here's an example of what I mean. I present the user with a list of sites from the main interface window. The user clicks on one of the sites and a new window opens to that site. From there, the user will navigate the site in a new window and eventually stop viewing or close the window. I need to find out what was the last visited location from this window. In addition, the user can navigate multiple sites at the same time, so many windows may open. I need to know what was the last place for each of them. So far, the only way I've worked is to use a timer and poll for a new window every second for document.location.href. There must be a better way.

+2


source to share


1 answer


As far as I know, this is not possible in (pure) Javascript for security / privacy reasons. On the other hand, since you are writing a Firefox plugin, you have additional mechanisms that you can use.



For example, you can create a greasemonkey plugin that is applicable to all sites. This plugin will record the href using GM_setValue (). The main plugin will read this information via GM_getValue ().

+2


source







All Articles