检查身份验证对话框中的域是否包含字符串

时间:2012-07-02 20:37:45

标签: javascript firefox firefox-addon xul

我正在尝试检查Firefox身份验证对话框中的网站域是否包含指定的字符串:

document.getElementById("prompt-password-message").textContent.indexOf("STRING")

其中STRING是我要找的字符串。

为什么上述代码不起作用的任何想法?

1 个答案:

答案 0 :(得分:0)

您需要获取'内容文档',否则getElementById()将不返回任何内容......

https://developer.mozilla.org/En/Working_with_windows_in_chrome_code#Accessing_content_documents

content.document.getElementById("prompt-password-message").textContent.indexOf("STRING")