相对路径,但对于港口? [英] Relative Path, but for Port?

查看:92
本文介绍了相对路径,但对于港口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都熟悉相对路径:来自 http://www.domain的 ./ images / hello.jpg 的相对路径。 com / hey 链接到 http://www.domain.com/hey/images/hello.jpg

We are all familiar with relative paths: A relative path to ./images/hello.jpg from http://www.domain.com/hey links to http://www.domain.com/hey/images/hello.jpg.

问题:如何说明 http://www.domain.com:1234 的相对路径你在 http://www.domain.com/hey

Problem: How do you state a relative path to http://www.domain.com:1234 when you are at http://www.domain.com/hey?

推荐答案

这可以通过设置 window.location.port 属性使用JavaScript来实现。

This can be achieved using JavaScript by setting the window.location.port property.

<a href="#" onclick="javascript:window.location.port=8080">go</a>

这篇关于相对路径,但对于港口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆