Techiio-author
Started by Teresa PortelaSep 14, 2021

Open
Tampermonkey doesn't fetch @require using localhost HTTPS static

0 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 0 VIEWES SHARE

Expected Behavior

In order to ease development i want to serve the necessary TM @require files through a localhost HTTP(S) server. I expected these files to be reloaded on each page reload.

Actual Behavior

The files are fetched from the localhost server when i update the UserScript in the TM editor, however, they are not fetched when a matched URL is loaded. I'm not sure if this is a caching thing by TM or if i'm doing something wrong here.

Specifications

  • FireFox 91.0.2
  • TM: 4.13.6136
  • OS: Windows 10
  • Matched URL: all LinkedIn pages

Script

To separate concerns in the JS files, the UserScript header is separated from other logic. The necessary files are imported using @required. This is the content of the UserScript file that is pasted in the TM editor:

// ==UserScript==
// @name myName
// @description myDescription
// @author robinlarondelle
// @version 0.1
// @namespace myNameSpace
// @homepage myHomePage
// @include *linkedin.com/*
// @icon https://www.google.com/s2/favicons?domain=linkedin.com
// @grant window.onurlchange
// @require https://localhost:3000/public/myScript.user.js
// ==/UserScript==

The localhost HTTPS static file server is a Node.JS server with a self signed certificate to enable HTTPS. When using Postman and FireFox after providing my .pem file, the server works as expected. If necessary i can provide more details about the server, but i don't think the problem resides here.

The main question/problem is: Why does @require from the UserScript header only fetch the required files on Script Save in the TM editor, but not on Page Reload when the URL matches? Is this normal behavior and/or can we turn this off?

0 Replies

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance