- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
考虑以下 Javascript:
var anchors = document.getElementsByTagName('a');
for(var i=0; i < anchors.length; i++)
{
alert(a.pathname);
}
当我在包含格式为“http://foo.com/bar”的链接的页面上运行它时,在 IE8 中我得到一个看起来像“bar”的字符串。在 Safari、Chrome、Firefox 中,我返回类似“/bar”的内容(注意前面的正斜杠)。
这里是 IE 的问题,怎么回事?
最佳答案
W3C standard on the window object - 包括位置界面 - 日期为 2006 年 4 月 7 日,即它是在实际实现多年后指定的。
标准如下:
pathname
This attribute represents the path component of the Location's URI which consists of everything after the host and port up to and excluding the first question mark (?) or hash mark (#).
这意味着应该包含前导斜杠,这与 Mozilla's implementation 一致.
MSDN doc on the location object没有提到该属性包含什么,而是一个 page on the VBScript location object有一个与你的发现一致的例子。
正如所说的页面是 ©1996 - W3C 介入的十年前 - 说 IE 有错是不公平的,但我仍然认为它是一个错误。
关于Javascript .pathname IE 怪癖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/956233/
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我有一个小的 win32 程序,它使用给定的 lpCmdLine 调用 CommandLineToArgvW int APIENTRY _tWinMain(HINSTANCE hInstance,
我有一个小的 win32 程序,它使用给定的 lpCmdLine 调用 CommandLineToArgvW int APIENTRY _tWinMain(HINSTANCE hInstance,
这是我为演示古怪行为而创建的示例。我希望 bash 按原样传递引用的命令行参数。 john@doe:~/tmp$ cat script.sh #! /bin/bash set -o xtrace $1
假设我定义了一个什么都不做的简单函数:function fn() { } 现在,当我运行 toString(fn) 时,我得到“[object Object]”。当我运行 toString.call(
我们面临以下检查在 IE 中间歇性失败的问题: 伪代码: setCookie("name","value", "1d"); if(getCookie("name") === "value"){ r
我安装了 Apache 2.4 以发布一个使用 Tomcat 8 作为 AS 的 java (Struts2) 应用程序。 有一段时间效果很好,然后发生了一些“奇怪”的事情(委婉地说)。 通过输入“h
我有以下 if 语句: RG 为“100”,最大值为“85” if (RG == "" | RG > max) { //Doesn't execute } 既然
我一直在为一个客户开发一个网站,我即将结束它。但不幸的是,IE6 让人很头疼。 我的主要问题在这个页面上: http://seaport.bythepixel.com/#storage 列表项没有元素
在 IE7 模式下,我在 IE9 中收到以下错误。使用一个小的计数脚本: SCRIPT1028: Expected identifier, string or number 代码 $.fn.count
感谢这里的帮助,我得到了一个基于 poll() 的大部分可用的 socks4 代理。我正在使用这个程序来学习 C 和套接字编程。该程序仍然缺少对部分写入的 send() 检查,但我相当确定这不是当前问
我认识的某个人刚刚学习编程,偶然发现了这个,让我感到困惑: 请打开控制台 (Chrome/Firefox) 并输入:var name = ['what', 'the', '...?']; 我希望 na
在 SignOut() 调用重定向到“...login.aspx?ReturnUrl=%2fmydomainname%2flogout.aspx”之后使用此方法,这样用户就无法再次登录,因为成功登录会
我写了一个函数,一旦用户满足表单的下一个字段的要求,它就会自动将用户推进到该字段的要求。 我的问题是,在 iPad 中使用它时,它不会聚焦下一个字段,而是隐藏键盘。 我已经放弃尝试修复此问题,并正在寻
考虑以下 Javascript: var anchors = document.getElementsByTagName('a'); for(var i=0; i < anchors.length;
我试图了解 R 的非标准评估。这是一个示例怪癖: > f g h g(1:10) [1] "x" > h(1:10) [1] "1:10" 怎么来的? g 和 h 结果之间差异的确切来源是什么? 编辑
我是一个涉足 C 的新手,我的小项目是编写一个简单的 SOCKS4 代理。感谢这里的帮助,到目前为止我已经在我的例程中使用非阻塞套接字和 poll() 了。然而此时我似乎有两个问题: 如果传入 Soc
我有这个代码:https://plnkr.co/edit/t1GKaQOGnFxkTMK03Ynk var MIN = 60; var HR = MIN * 60; var tripDom
我将如何使用功能检测来确定是否需要在禁用的输入元素上模拟标题属性。 我知道 Firefox 声明并解释了该规范,以便它按预期工作,但我仍然希望显示工具提示。 我唯一能想到的就是直接使用浏览器检测。 可
我遇到了一些关于框架和 Internet Explorer 的非常奇怪的行为。 情况是这样的: 我在 www.webapp.com 上有我的网络应用程序 我有一个客户想要在他的网站上有一个登录框到我的
我是一名优秀的程序员,十分优秀!