Reported modules are:
(plus in contrib, forumng)
a) Change the script to use referer and apply relative paths
b) Change all the modules to use absolute paths
I prefer option (b) because referer information is not guaranteed to be reliable (and if we are in odd case with non-JS then maybe we are in odd case with referer). As an addition, I also think that the function should give a developer debug warning if a relative URL is passed.