Reputation: 2160
I have created some javascript code which searches the DOM and exposes some information for myself in the console, but in order this to work every time I have to go to Sources part of the console, go to the snippets part, click on the snippet name and run it.
Is there a way to make it autorun? Thanks!
Upvotes: 28
Views: 20748
Reputation: 1292
I use Chrome feature "Event Listener Breakpoint > Script > Script First Statement" that places breakpoint before first line of each script.
I check it on ten reload the page and before first script execution the Chrome pauses. I run all the snippets and code I need then I remove the breakpoint and resume the page load.
Upvotes: 1
Reputation: 21203
nov 2019 : These are current Chrome Extensions that can run scripts on any page you want
Upvotes: 3
Reputation: 21
From what I understand, currently, this is not possible. If you want to auto-run javascript on websites I recommend using something like Tampermonkey chrome extension. It allows you to inject your client's webpage with javascript that automatically runs.
Upvotes: 2
Reputation: 2132
idk, been using "Custom JavaScript for websites" chrome extension: https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija
Upvotes: 4