FG
šŸ’» Software

How to get Firefox Greasemonkey script to use a local cascading stylesheet?

Fresh7 days ago
Mar 15, 202615584 views
Confidence Score0%
0%

Problem

What's the correct syntax to link to a CSS file in the same directory as a Greasemonkey JavaScript? I've tried the following but it doesn't work: If I can get this to work, it would be a lot easier than encasing CSS changes in JavaScript.

Error Output

var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = 'example.css';
cssNode.media = 's…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to get Firefox Greasemonkey script to use a local cascading stylesheet?

Low Risk

This is easy with the directive. Like so: With no path/url information, looks for "YOUR_CSS_File.css" in the same directory.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment