Custom-JavaScript-for-Websites-2 icon indicating copy to clipboard operation
Custom-JavaScript-for-Websites-2 copied to clipboard

URL change

Open darkzbaron opened this issue 8 years ago • 1 comments

I run a script on domain.com. I have specified in my script that it should only run on domain.com/subdomain1. However, when I navigate back and forther between domain.com and domain.com/subdomain1 or domain.com/subdomain2 the script keeps running.

I am no expert in JS and frankly lost. Any help would be appreciate!

Thanks for the great work anyway.

Jonathan

darkzbaron avatar Dec 04 '17 12:12 darkzbaron

There is existing issue for this #5

But unfortunately, there are some difficulties to implement such functionality and need to redesign the entire logic for injecting scripts.

There is a workaround to handling such cases: write a function to check whether the domain is the desired domain you need, like:

function domainMatched() {
  return window.location.href.contains("domain.com/subdomain1"))
}

xcv58 avatar Dec 04 '17 17:12 xcv58