Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
Tampermonkey doesn't fetch @require using localhost HTTPS static files

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.

Things to point out:

FireFox prohibits accessing local files from TM (see this comment). So one alternative to this problem would be to just use Chrome, as it does support accessing local files. However, i want to abstain from using local files because there are multiple developers working on this project. I also don't want to limit development to one specific browser.

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?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I have created a GitHub issue on the Tampermonkey repository as well and someone came up with the solution:

Set "Externals" update frequency to "Always". This will fetch the @require tag on page reload. This does however not run smoothly and most of the time it will fetch after page reload (so you have to reload twice).

Anyways, this solved the problem for me.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda