js获取当前url】的更多相关文章

我们可以用javascript获得其中的各个部分 1, window.location.href 整个URl字符串(在浏览器中就是完整的地址栏) 本例返回值: http://ifisker.com/blog/post/0703/window.location.html# 2,window.location.protocol URL 的协议部分 本例返回值:http: 3,window.location.host URL 的主机部分 本例返回值:www.x2y2.com 4,window.loca…
转载地址:js如何准确获取当前页面url网址信息 摘录: 举例一个URL,然后获得它的各个组成部分:http://i.cnblogs.com/EditPosts.aspx?opt=1 1.window.location.href(设置或获取整个 URL 为字符串) var test = window.location.href; alert(test);返回:http://i.cnblogs.com/EditPosts.aspx?opt=1 2.window.location.protocol(…
下面我们举例一个URL,然后获得它的各个组成部分: http://i.cnblogs.com/EditPosts.aspx?opt=1 window.location.href (设置或获取整个 URL 为字符串) var test = window.location.href; alert(test); // 返回:http://i.cnblogs.com/EditPosts.aspx?opt=1 window.location.protocol (设置或获取 URL 的协议部分) var t…
document.location 这个对象包含了当前URL的信息 location.host 获取port号 location.hostname 设置或获取主机名称 location.href 设置或获取整个URL location.port设置或获取URL的端口号 location.search 设置或获取href属性中跟在问号后面的部分 如:?aaa=123&bbb=456$ccc=789 js中window.location的应用 URL即:统一资源定位符 (Uniform Resour…
设置或获取对象指定的文件名或路径. window.location.pathname例:http://localhost:8086/topic/index?topicId=361alert(window.location.pathname); 则输出:/topic/index 设置或获取整个 URL 为字符串.window.location.href例:http://localhost:8086/topic/index?topicId=361alert(window.location.href)…
window.location 属性 描述 hash 设置或获取 href 属性中在井号"#"后面的分段. host 设置或获取 location 或 URL 的 hostname 和 port 号码. hostname 设置或获取 location 或 URL 的主机名称部分. href 设置或获取整个 URL 为字符串. pathname 设置或获取对象指定的文件名或路径. port 设置或获取与 URL 关联的端口号码. protocol 设置或获取 URL 的协议部分. sea…
介绍:设置或获取对象指定的文件名或路径. window.location.pathname //返回 设置或获取整个 URL 为字符串. window.location.href 设置或获取与 URL 关联的端口号码. window.location.port 设置或获取 URL 的协议部分. window.location.protocol 设置或获取 href 属性中在井号“#”后面的分段. window.location.hash 设置或获取 location 或 URL 的 hostna…
1.window.location.href(设置或获取整个 URL 为字符串) 2.window.location.protocol(设置或获取 URL 的协议部分) 3.window.location.host(设置或获取 URL 的主机部分) 4.window.location.port(设置或获取与 URL 关联的端口号码) 5.window.location.pathname(设置或获取与 URL 的路径部分(就是文件地址)) 6.window.location.search(设置或获…
首先要知道Location这个对象以及这个对象中的一些属性: href:设置或返回完整的url.如本博客首页返回http://www.cnblogs.com/wymninja/ host:设置或返回主机名和当前的URL的端口号.本博客首页返回www.cnblogs.com hostname:设置或返回当前URL的主机名.本博客首页返回www.cnblogs.com hash:设置或返回从井号(#)开始的URL(锚).本博客首页返回 空 pathname:设置或返回当前URL的路径部分.本博客首页…
1)使用 XMLHttpRequest 对象获取图片url的Blob值 //获取图片的Blob值 function getImageBlob(url, cb) { var xhr = new XMLHttpRequest(); xhr.open("get", url, true); xhr.responseType = "blob"; xhr.onload = function() { if (this.status == 200) { if(cb) cb(this…