Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Feature Request: GM_info.script.downloadUrl #1644

ikarlik opened this Issue · 1 comment

2 participants


Currently, there is no way for the user script itself to know what URL it was downloaded from.

This comes useful if the same script is deployed to multiple environments (i.e. can be installed from different URLs) and needs to make an AJAX call to a resource on the same environment that it came from.

For example, if my script is installed from OR
I'd like GM_info.script.downloadUrl to return the appropriate URL so I could determine the host and call OR

The only workaround I could come up with is to have a
// @resource downloadHost getHost.php
where getHost.php determines where it's being served from and ouputs the path to itself. For example, if you browsed to the response would be "".
Then in my user script I can call GM_getResourceText('downloadHost') and it would return me "" no matter what URL my script runs at.

Such workaround is an overkill though and it would be so much easier if you could expose script's original download URL via a property like GM_info.script.downloadUrl.



This is probably a reasonable request. Might need to spend some time thinking about privacy implications.

Another possible (simpler?) workaround: put a file named "environment.js" next to each script. // @require environment.js and have each one assign a value to a particular variable. No special server side logic, just another file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.