JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
2013-03-08 15:22
951 查看
1.获取当前完整网址
2.获取当前域名信息
3.获取当前页面
<script type="text/javascript"> thisURL = document.URL; thisHREF = document.location.href; thisSLoc = self.location.href; thisDLoc = document.location; strwrite = " thisURL: [" + thisURL + "]<br />" strwrite += " thisHREF: [" + thisHREF + "]<br />" strwrite += " thisSLoc: [" + thisSLoc + "]<br />" strwrite += " thisDLoc: [" + thisDLoc + "]<br />" document.write( strwrite ); </script>
2.获取当前域名信息
<script type="text/javascript"> thisTLoc = top.location.href; thisPLoc = parent.document.location; thisTHost = top.location.hostname; thisHost = location.hostname; strwrite = " thisTLoc: [" + thisTLoc + "]<br />" strwrite += " thisPLoc: [" + thisPLoc + "]<br />" strwrite += " thisTHost: [" + thisTHost + "]<br />" strwrite += " thisHost: [" + thisHost + "]<br />" document.write( strwrite ); </script>
3.获取当前页面
<script type="text/javascript"> tmpHPage = thisHREF.split( "/" ); thisHPage = tmpHPage[ tmpHPage.length-1 ]; tmpUPage = thisURL.split( "/" ); thisUPage = tmpUPage[ tmpUPage.length-1 ]; strwrite = " thisHPage: [" + thisHPage + "]<br />" strwrite += " thisUPage: [" + thisUPage + "]<br />" document.write( strwrite ); </script>
相关文章推荐
- JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
- js获取当前页面的网址域名地址
- php获取当前域名、主机、URL、端口、参数、网址、路径、代理等
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- PHP获取 当前页面名称、主机名、URL完整地址、URL参数、获取IP
- js取得当前url,javascript获取当前页面url值,js获取域名
- PHP获取 当前页面名称、主机名、URL完整地址、URL参数、获取IP
- js如何准确获取当前页面url网址信息
- JS获取当前完整的url地址以及参数的方法
- js准确获取当前页面url网址信息
- 用js得到当前页面的url信息方法(JS获取当前网址信息)
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- 获取当前页面完整URL地址
- js如何准确获取当前页面url网址信息
- js如何准确获取当前页面url网址信息
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- [JavaScript] js获取当前页面url网址信息
- 前端js得到当前页面的url信息方法(JS获取当前网址信息)