1

I have a local javascript file. I want to be able to load it automatically on an external website (a tumblr blog in my case) every time when the page reloads.

I'm working on Chrome, and currently every time I want to see the effects of my script, I have to go to Developer tools and insert this into the HTML:

<script src="file:///C:/Users/decho/Desktop/script.js"></script>

Obviously the changes I make are gone every next time I refresh the page and that's a very inconvenient way to work on it. Tumblr lets you modify the HTML so I added a link to my script, but it got rejected because it's a local file (probably for security reasons).

So my question is, is there any easy and convenient way to load a local script to an existing website, without having to manually edit the HTML with Developer tools every time you reload?

3
  • Are you telling me this from similar experience that you had or it's an assumption? Commented Jun 4, 2014 at 17:03
  • 1
    maybe en.wikipedia.org/wiki/Greasemonkey or equivalent can help you Commented Jun 5, 2014 at 5:49
  • Darn I was coming to suggest greasemonkey. It's what I use :D Infer-On you should post the answer. You beat me to it :P Commented Jun 5, 2014 at 7:40

1 Answer 1

1
  1. Download Tampermonkey extenstion from Chrome Web store.
  2. Type chrome://extensions and check "Allow access to file URLs".
  3. You can now use the file path inside your @require statement.

Here is an example showcasing this functionality:

// ==UserScript==
// @name          test script
// @namespace     http://www.example.com/
// @description   test script
// @include       http://websitethatyouwanttoaffect.com
// @require       file:///C:/path/to/your/script.js
// ==/UserScript==
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.