22

I've written scripts to filter out threads and posts in a programming forum by author.

But you need to post the code into the web console for each page individually.

I was wondering if it were possible and if so how (using either firefox or chrome), to set your browser up to run a specific script upon loading a specific site? Is it possible as an extension or plugin?

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260

2 Answers2

20

You can use Tampermonkey for Google Chrome

Tampermonkey is the most popular userscript manager for Google Chrome.

Greasemonkey for Firefox:

Allows you to customize the way a web page displays or behaves, by using small bits of JavaScript.

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
4

You can use dotjs.

dotjs is a Google Chrome extension that executes JavaScript files in ~/.js based on their filename.

If you navigate to http://www.google.com/, dotjs will execute ~/.js/google.com.js.

This makes it super easy to spruce up your favorite pages using JavaScript.

Community
  • 1
  • 1
Aliou
  • 1,065
  • 11
  • 17
  • I've never used dotjs, but this seems like the most valid option. Or the user could create their own Chrome extension that uses "Content Scripts". https://developer.chrome.com/extensions/content_scripts – David Mar 28 '14 at 08:45
  • If OP only needs to customize one website, indeed your solution would be more appropriate. Could you add it as an answer. – Aliou Mar 28 '14 at 08:47
  • But if I want to upload my javascript on existing website in such a way that all users can see the change then what to do @Aliou ? as all users can't have dotjs, greasemonkey or Tempermonkey – Maulik Jan 25 '17 at 10:15
  • 1
    If the website is yours, you should include the javascript in it. Otherwise I don't think there is a clear solution. – Aliou Jan 25 '17 at 10:31