2009 02 07 21 29 [UserChrome] 使用 https 去登入 Xuite

因為 Xuite 預設是使用 http 去登入系統,

但是 http 實在一點也不安全。

所以寫了個 UserChrome.js 去 Redirect 原本的 url 。

讓原來的 http 用 https 來取代。

(function() {

function examplePageLoad(event)
{
if (event.originalTarget instanceof HTMLDocument) {
var doc = event.originalTarget;

if (/^http:\/\/member\.xuite\.net\/HiReg\/loginform2_mbr\.jsp\?/gi.exec(doc.location.toString())) {
doc.location=doc.location.toString().replace(/^http:/gi,"https:");
}
}
}

gBrowser.addEventListener(
"load",
function () {
// Add a callback to be run every time a document loads.
// note that this includes frames/iframes within the document
gBrowser.addEventListener("load", examplePageLoad, true);
},
false
);

})();