Blackbing Playground

IE bug 情報

最近遇到幾個IE的bug,在此紀錄如下:

以下節錄自解决javascript中的window.open返回object的错误

系统中用javascript中的window.open后,页面返回了一个[object]。因为系统的原因,必需使用href=”javascript:window.open()”这样的格式。所以只能通过以下办法解决。

[source language=”javascript”]
<a href="javascript:void(window.open(‘’,’’,’width=200,height=200’))">window.open()</a>
[/source]




用window.location獲取不到Referer? 最後找到這篇文章提供的方式來解決。

原來IE的Referer僅提供 Link的方式,以下節錄自“Referer” header not set on HTTP requests originating from assignment to “window.location” variable on IE

[sourcecode language=”javascript”]
function goTo(url) {
var a = document.createElement(a);
if(!a.click) { //only IE has this (at the moment);
window.location = url;
return;
}
a.setAttribute("href", url);
a.style.display = "none";
$("body").appendChild(a); //prototype shortcut
a.click();
}
[/sourcecode]