爱思刷机刷机教程
09-01 405
获取当前url |
js 获取url,如何获取当前页面的url
Method1URLSearchParams()functiongeturlparam(){letthat=this//window.location.hrefgetaddressleturl='https://xxxx/xxx/demo?type=1&id=2'letp=url.split('?')JS获取当前页面的URL可以使用下面的代码:window.location .href可以获取完整的URL。 示例window.location.href尝试»我们还可以获取URL的一部分:示例levaru
?▽? 除了通过window.location获取URL地址之外,还可以通过document.URL属性获取页面的URL。 使用document.URL和使用window.location.href获取页面的完整URL地址是一样的1.获取当前页面的完整URL:leturl=location.href;console.log(url)//--天使的博客_CSDN博客-田博主2.获取当前页面的域名:lethost1=window.loc
,可以使用window.location对象获取当前页面的URL信息,然后通过字符串处理得到URL参数。 js获取当前url1,window.location.href(设置或获取整个URL作为字符串)2,window.location.protocol(设置或获取URL的协议部分)3,window.location.host(
7.window.location.hash(setorgetthesegmentafterthehrefattribute)console.log(window.location.hash)printresult:emptycharacter(becausethereisnourl)aboveisjstogeturlaxiosaxiosisa基于Promise的HTTP客户端,可以在浏览器和Node.js中使用。 它提供了简洁的
后台-插件-广告管理-内容页尾部广告(手机) |
标签: 如何获取当前页面的url
相关文章
发表评论
评论列表