Replace jQuery version of a page with Greasemonkey

后端 未结 4 1554
鱼传尺愫
鱼传尺愫 2020-12-24 10:20

How can i replace jquery version of a page with greasemonkey?

Im trying to test a site with a newer version of jquery but i dont have a dev enviroment.

4条回答
  •  天命终不由人
    2020-12-24 10:37

    Not sure about Greasemonkey, but an easy approach to modify any resource on (url, image, script) would be using Requestly Redirect Rule.

    1. Open Requesly app from icon (or navigate to http://app.requestly.in/rules)
    2. Click "New Rule"
    3. Select "Redirect Request"
    4. Enter Request source (in your case, "URL""Equals":[url-to-jquery eg: "http://some-host.com/jquery1.4.js"]
    5. Enter Destination (in your case, URL to required jquery version CDN eg: "http://any-host.com/jquery3.2.js")
    6. Click Save
    7. Done! Now all the requests made by your browser to source url will be redirected to your defined destination url.

    Note:

    • If you don`t have CDN, you can host the file on web using Requestly Library. Then choose "Select from Library" below Destination URL field.
    • The same results can be achieved using Cancel Request rule to block existing request. Then use Insert Scripts rule to insert your version of script into the webpage.

    PS: I work at Requestly.

提交回复
热议问题