Is there a way I can capture window.alert and window.confirm raised by the documents loaded in the page?
I tried,
window.alert = function(txt) {
// my code here
}
but this works only for code within my extension. How can I extend this to the page that is loaded?
Thanks,
Vinay
capture window.alert, confirm from the extension javascript
-
- Posts: 4
- Joined: October 5th, 2005, 3:11 pm
-
- Posts: 4
- Joined: October 5th, 2005, 3:11 pm
Thanks for the quick reply,
As a test, I tried to do this,
content.alert = function (txt) {
window.document.location = "http://www.google.com";
}
This seemed to have no effect on the document alerts!
I also tried to just suppress the alert by emptying the function, did not help either.
But if i have the same code in the document's <script> tag, it works fine, In extension's code, it doesn't
As a test, I tried to do this,
content.alert = function (txt) {
window.document.location = "http://www.google.com";
}
This seemed to have no effect on the document alerts!
I also tried to just suppress the alert by emptying the function, did not help either.
But if i have the same code in the document's <script> tag, it works fine, In extension's code, it doesn't
-
- Posts: 4
- Joined: October 5th, 2005, 3:11 pm
Also, wanted to know if this is possible, this also does not seem to work.
Code: Select all
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
var promptServiceAlert = promptService.alert;
// override prompt service alert
promptService.alert = function (parent , dialogTitle, text) {
promptServiceAlert(parent, dialogTitle + "my custom text : ", text + "append");
}
-
- Posts: 4019
- Joined: November 16th, 2003, 3:05 am
- Location: Russia, Moscow