There's a website on my uni localnet which serves an inline css for body

<body class="maincon" style="somejunk">

making it look weird. Removing inline style with the Firefox Inspector (F12) makes it look fine again but I'd like to do that automatically on every page load for this domain.

What is the simplest way to achieve that, preferably in Firefox? A Greasemonkey script? Or is there a native method?


Use the Greasemonkey add-on to make the following JavaScript code run on load of the page :

var x = document.getElementsByTagName("BODY")[0];

For your convenience I created a demo that shows the code in action here. Click the Run button to see it work.

To learn how to use Greasemonkey, see
The Beginner’s Guide to Greasemonkey User Scripts in Firefox.

| improve this answer | |
  • Wow. You really went above and beyond. Thanks! – Damn Terminal Jun 22 '17 at 20:24

The Firefox DevTools don't have a way to apply a change to a website everytime the page loads.

If it's really just some layout change, Stylish is the right add-on to use. And if the change also relates to functionality, a GreaseMonkey script is the way to go.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.