Is it possible to have a javascript read elements from one browser tab from another? What I want to do is have a simple script that refreshes a page that I don’t host every second or so and if the text on it changes from a preset string then to stop refreshing. So I have one tab open running the JS that I host which is pressing refresh repeatedly on the other tab and if that changes then it stops refreshing.
I’ve tried to think of a way to do this server-side (PHP) but couldn’t think of one. I could make a script that reads the remote page repeatedly and if it changes then loads it, but to load it the remote page would refresh and then would probably lose the string I am after.
Any help much appreciated! Even if just to say “nah, not possible” or something about XSS that I don’t really understand…!
You could take a look at greasemonkey to create a userscript that does this for you.
The greasemonkey wiki is a good source to get you started on writing your own script
Note that greasemonkey is for firefox, but there similar methods available for Opera, Chrome and Safari. And also for IE7Pro (not for IE itself).
Google for “greasemonkey” and the name of your browser to find out more