# If we can require a particular domain, can we require a particular path?

## Background

Following on from this question where it was decided that, as we define languages by their implementation, JavaScript solutions could include a requirement that they be run under a specific domain. This allows us to use, for example, /questions/[id]?site=codegolf instead of //api.stackexchange.com/questions/[id]?site=codegolf to save a few bytes.

In a recent solution I took this a (small) step further, requiring that it be run at the root level of api.stackexchange.com and using questions/[id]?site=codegolf to save another byte.

## Proposal

But that then got me to thinking: if we can require a specific domain then we could, by extension, be able to require a specific path, with the above example becoming simply [id]/?site=codegolf if run from api.stackexchange.com/questions/.

Personally, I feel that it's pushing things too far but couldn't come up with a legitimate argument against allowing it so decided to post this question to garner some thoughts from the community and, hopefully, reach a consensus on it.

• I think it should work similar to running from a custom directory, but I can't remember how that works. – NoOneIsHere Sep 21 '17 at 17:28
• Really, this should be a comment on the linked question, or a separate answer outlining the problems with accepting the current answer - the question is basically the same. I for one have upvoted the 'second' answer, seeing how problematic an exact definition of the 'first' answer is. – Sanchises Sep 22 '17 at 14:18
• Possible duplicate of Can JS answers require the code to be run at a certain domain? – Sanchises Sep 22 '17 at 14:18
• I don't see how this is a duplicate. This question is a follow-up to that question that asks if full paths can be specified instead of only a domain. The proposed duplicate is even linked to in the question. – LyricLy Sep 23 '17 at 0:40
• This probably applies to running locally too, e.g. a bash script that only works if your current directory is /usr ? – Neil Sep 24 '17 at 0:11
• You definitely shouldn't be allowed to specify a path that's not, say, on a static sitemap. Otherwise every answer becomes eval(base64decode(window.location.pathname[5,5432]))) – histocrat Sep 28 '17 at 20:34
• @histocrat Why use .pathname when you can use .search? – Neil Oct 1 '17 at 14:21