I'd like to find the document location during runtime for a script I'm using, and having next to no experience with JavaScript, I don't know how.

For example, if my document is local:

If my site is live:

How can I extract everything but the script name and put it in a variable?