0

is possible to run a script in chrome / firefox / msie's developer tools that survives to page loads/reloads?

for example, I want to get a link URL in page A, load that URL B and get its page title, then I want to return back in page A, select another link and so on

now, if I call window.location.href = somelink; the new page is loaded but the script dies while changing page

is this possible?

thank you in advance

  • Yes if you write an extension/addon for each browser you want to support. Scripts can't _survive_ cross sites (each link may point to a different site) primary for security reasons. – Adriano Repetti Jul 03 '13 at 08:29
  • Greasemonkey scripts survive though. :) – NoBugs Oct 12 '13 at 05:38

2 Answers2

1

You could probably write a Greasemonkey script to do this, since Greasemonkey has the ability to store data.

Something like if (location.host=='stackoverflow.com') {set some setting, go to other page} could work for multiples sites.

I'm not sure about the userscript storage support in other browsers like Opera/Chrome though.

Community
  • 1
  • 1
NoBugs
  • 9,310
  • 13
  • 80
  • 146
0

You could try creating a new Snippet in Sources, and run that each time.

I believe also, that if you run a script in the Console, with preserve log turned on that it will keep whatever is entered into the console until the devtools is closed. It gets stored in V8 if I'm not mistaken, I could be. I'd try that out though too, since I feel like it does.

jaredwilli
  • 11,762
  • 6
  • 42
  • 41