I don’t know that there is a really nice way to do this, but one possibility is for your server code to write a small block <script>on the page to declare some variables that your packaged Javascript can detect and use.
<script>
var pageGlobals = {
interestingURL: <% ... url %>,
...
};
</script>
I did this to keep track of things like sub-directories of images that are defined by a child of a client. Javascript code just knows that whenever it is needed for a URL, it can just go to the global object and select a standardized variable.
, , Javascript, <script> - . , .