How can js modify another js file to ensure that the js will not be modified again?

is dealing with a requirement, which goes something like this: is to determine where the entry of the website comes from . If the website is linked from a certain platform (for example, when a web page is placed on the e-shift platform for light application), you need to record the parameter xx, of url and then jump to the authorization page once the login credential token expires. If the website is entered from our own login page, token fails to jump to its own login page instead of to the authorization page

my idea is: because when entering a web page from the platform, the url of the page will take a parameter xx, of that platform, and then I use a global js to record the xx,. I hope that the global js can be used by each page: similar to

.
js:
function yy(name){
 ...//url
}
var xx=yy(name);//,url

but in this case, if I call the global js on every page, because only the entry page has the parameter of url, so the url of other pages does not have this url parameter. This will cause the xx not to be a fixed value. Which page call will refresh the js, on that page and the xx recorded by the js file will be overwritten when the page calls the js file, so is there any way to solve it?

Mar.23,2021

is saved in cookie or session or localstorage


this is usually saved with cookie or session.


cookie learn about
window.name

Menu