2

The script below works on a normal webpage, but how I can make it work on local .htm files too? (When opened in the Chrome browser)

// ==UserScript==
// @name            betterTwitter
// @version         0.5
// @namespace       http://www.h4xful.net/
// @description     Gets rid of the garbage on Twitter's side-panel.
// @include         http://twitter.com/*
// @include         https://twitter.com/*
// @include         file://C:/Users/*.htm
... ... 

The last line (@include file:...) doesn't work at all. The script doesn't fire for a sample page.

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
ivill
  • 13
  • 1
  • 8

1 Answers1

3

First, on Chrome's extensions setting page (chrome://extensions/), make sure Tampermonkey has access to file URLs:

File URL setting

Second, format the @include (or @match) with the correct number of slashes. It should almost always start with file:///.
For example:

// @include    file:///C:/Users/*.htm
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
  • Thanks Brock Adam, after the edit, the script appeared to available (the extension shows 1 working script on the page), but it is actually not working on local htm webpage, here is how i test the script: – ivill Dec 24 '15 at 04:48
  • open a local htm file with google chrome, the script does not work to remove and re-range the twitter webpage (only works on normal webpage), could you have a test on the script on local .htm ,thanks alot – ivill Dec 24 '15 at 04:52
  • @ivill, since Tampermonkey shows a working script, that's this question answered. You can put the line: `console.log("Hello");` immediately after your script's metadata block. Then run the page and you'll see the message in the console. ... As for why your specific script doesn't run the way you expect on the local page, you did not include enough information for us to know, and it's beyond the scope of this question. Open a new question for that **but only if you provide an MCVE** in the new question. – Brock Adams Dec 24 '15 at 06:44
  • Thanks again, the issue fixed, and i will start a new question. – ivill Dec 24 '15 at 13:33
  • @sanjihan, *Probably*, but I don't know for sure, nor the exact settings. I no longer have easy access to Safari. Suggest you look/ask on [the Tampermonkey support forum](https://forum.tampermonkey.net/). – Brock Adams May 22 '16 at 20:42