I am looking for a userscript that replaces the part of URL if certain values are found in it. Below code seems to be working and replacing the URL, but problem is that it keeps on reloading/refreshing the page after URL is changed. I am new to all this, what am I doing wrong?
// @include http://*
// @include https://*
// @run-at document-start
// ==/UserScript==
var url = window.location.href;
if (url.search("images.abc.com") >= 0) {
url = url.replace('300','620');
window.location = url;
}