I'm trying to access a javascript file that sits on a subdomain through a page that is a subdomain of the first subdomain. That is, I have a page at admin.www2.mysite.com
that I'd like to have access to scripts in the www2
subdomain ( <SCRIPT SRC="www2.mysite.com/resources/scripts/javascript/file.js"></SCRIPT>
)
Even hardcoding the link in like this doesn't work. I still get a 404. Even though looking at the src
attribute in the head of the document seems right
<SCRIPT SRC="www2.mysite.com/resources/scripts/javascript/file.js" TYPE="TEXT/JAVASCRIPT"></SCRIPT>
Directly below it there is the error:
GET http://admin.www2.mysite.com/add_user/www2.mysite.com/resources/scripts/javascript/file.js
directory within admin ------> ^^^^^^^^
I have tried to get at it by using , but <SCRIPT SRC="<?=$_SERVER['HTTP_HOST']?>/resources/scripts/javascript/file.js
gives me the error:
GET http://admin.www2.mysite.com/cyrious_add_user/admin.www2.mysite.com/resources/scripts/javascript/file.js 404 (Not Found)
The directory admin
is physically inside the directory www2
on the server.
How can I navigate from this sub-sub domain to the other subdomain?
You're omitting the scheme from the URL which causes it to be a relative path (hence the first error). Simply add a scheme:
src="//www2.mysite.com..."
The //
will use the same scheme as the page request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.