L
L
legrapho2012-11-11 23:29:38
JavaScript
legrapho, 2012-11-11 23:29:38

How can I change the script download address with an extension?

The general task is this: you need to redefine js functions on a specific page using an extension.
In Chrome, the issue is solved using the function chrome.webRequest.onBeforeRequest.addListener
For example, there is a page:

<head>
<script type="text/javascript" src="http://mozilla.org/script.js" />
</head>
<body>
..
</body>

The extension replaces the loaded script with http://my-mozilla.org/script.js
In Firefox, apparently, there is no analogue ( question on the stack )
There is an option to prohibit the loading of the script, as adblock does, for example, and add a content script to the page that will override the functions.
However, I still don't know the best way to do this.
Any thoughts on this are welcome.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Piratborn, 2016-03-20
@Piratborn

As far as I understand, you need to replace the script on someone else's site? Greasemonkey
extension is suitable for this . Google it or userjs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question