Suppose there are two websites say A
and B
Now website A
contains a script tag
<script type="text/javascript" src="http://B.com/some_path</script>
whose src refers to a php script in Website B
that outputs valid javascript code
Is there a way to get the url of website A
from which the script is being called
Edit: sorry my bad that I didn't mention that I want the url in the php script and not in the javascript which is the output of php script refrenced from script src
document.referrer
This is the javascript command that should get the http_referrer string of the page that it was clicked from
You can use either
window.location.href
or
document.URL
to retrieve the URL in your JS code