0

There are several variations of the question how to replace part of the URL with JavaScript?

but the solutions work for a current url, so first you load a page and then click on the bookmark that stores the javascript code to go to the edited location.

Is there a way to make this a default in Firefox? That is, if I click on a link and that link contains a specific chunk /epdf/ I want that chunk replaced with /pdf/ before loading the page in the first place.

I have created a bookmark that contains the script

javascript:var url = window.location.toString(); window.location = url.replace(/epdf/, 'pdf');

but that has the limitation I described above. Is there a way to perhaps load that script as a plugin on Firefox?

(I am way out of my depth here, not even sure what search terms to use for this)

0 Answers0