开发者

Get url with javascript

开发者 https://www.devze.com 2023-01-17 00:46 出处:网络
I want to get the url with javascript. But I just need http://www.mysite.com, without any parameters beh开发者_开发问答ind it. any idea how to get that?Use this:

I want to get the url with javascript. But I just need http://www.mysite.com, without any parameters beh开发者_开发问答ind it. any idea how to get that?


Use this:

var url = window.location.protocol + "//" + window.location.host;


window.location.hostname


try

window.location.protocol+'//'+window.location.hostname
0

精彩评论

暂无评论...
验证码 换一张
取 消