Home > Article > Web Front-end > Problems with intranet and extranet hyperconnection_html/css_WEB-ITnose
My website access address: LAN: 10.0.0.8 External network access address: www.xxx.com
Set the ABCDE hyperlink in the web page to 4f8e7340b1846412643cc93e8bdca2cb
If in the LAN: Equivalent to: 4ca0213740ecd95c26eefbdd21de9085ABCDE5db79b134e9f6b82c0b36e0489ee08ed
If in the external network: Equivalent to:d71a5c67c84d736688916098f6ae4067ABCDE5db79b134e9f6b82c0b36e0489ee08ed
The problem is that there is a special connection
in the LAN: 10.0.0.8 :81/b.html
On the external network : www.xxx.com:81/a.html How do I write code
If there is a port, it must be written as an absolute path
Write relative paths. When the link is opened, the browser will automatically add the corresponding server path
For example,
< ;a href="a.html">A5db79b134e9f6b82c0b36e0489ee08ed
I use http://www.xxx.com:81 to access the external network. When I click the link, it will automatically open www.xxx.com:81 /a.html
Use IP to access the intranet. When you click the link, it will automatically open http://10.0.0.8:81/a.html
If it is cross-domain, the above will not work. ( Different addresses or different ports are usually cross-domain)
As 2# said, just bring the port number when accessing.
If it is a special requirement, the port number is not included when accessing, but a special page requires a port number. You can use js to obtain the host header and output the link
<script>var host=location.host;//主机头var inet=host.indexOf('xxx.com')//外网document.write('<a href="http://'+host+':81/'+(inet?'a':'b')+'.html">ABCDEFG</a>');</script>
Change
<script>var host=location.host;//主机头var inet=host.toLowerCase().indexOf('xxx.com')!=-1//外网////////document.write('<a href="http://'+host+':81/'+(inet?'a':'b')+'.html">ABCDEFG</a>');</script>
Yes, the test was successful. Wait two days for the test to be completed and see if it can be completed by html code