 
                        前端新兵,今天遇到个问题,向各位大牛请教。
我有一个页面,地址为 http://192.168.3.197:8888/login.do?method=toLogin
在这个页面里有一个链接,我想点击这个链接,跳转到 http://192.168.3.197:8888/
我是这样写的:
$("#a").click(function(){
    window.location=location.protocol+location.host;
});
但是,点击之后,却跳转到了
http://192.168.3.197:8888/192.168.3.197:8888
这是为什么呢?以及要怎么写才能跳转到正确地址呢?
谢谢!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
应该是
location.href = location.protocol + '//' + location.host完整的url里有'//'
protocol是协议hostname是主机port是端口如果是单一服务器跳转,直接使用相对路径吧:
http://192.168.3.197:8888/login.do?method=toLogin
要跳转到
http://192.168.30.177:8888/
这个2个地址完全没有啊
不就好了
还是说要跳到
http://192.168.3.197:8888?