I have a webapp that makes calls to a database. Every once in a while, we get a javascript alert dialog that says that the transaction was deadlocked. Honestly, we don't care if that happens because it's not an interactive app...it just displays data based on a timer and if it misses it this time, it's okay to display it next time around.
I know you can over write the alert method like so:
window.alert = function alert(msg) {
console.log('Hidden Alert ' + msg);
};
(found at Can I prevent an alert() with a Google Chrome Extension)
The question I have is: Is there a way to see if the message for the alert .contains
a specific word or phrase, ignore the alert call if it does but display the alert otherwise? Installing an extension to deal with this really isn't an option.
Clarification:
I know how to catch it if it does or doesn't but what code would I write to go ahead and display the alert like normal if I'm over writing the alert code?
window.default = window.alert;
window.alert = function alert(msg) {
var word = 'foo';
if (msg.indexOf(word) != -1){
console.log('contains');
// do what you wanna do if contains
}else{
window.default(msg);
}
};
alert('foo');
alert('bar');
Here is my approach.
I'm trying to use formdata object to send form data to my server. I need this because one of my input fields is a file. However the formdata object is blank when I try to send the data to my server, ...
I'm trying to use formdata object to send form data to my server. I need this because one of my input fields is a file. However the formdata object is blank when I try to send the data to my server, ...
I have a form, which allows to select an item from a dropdown list and upload a file. The name and the ID of the item are saved in a Spreadsheet document. Works with one file...but I want to upload ...
I have a form, which allows to select an item from a dropdown list and upload a file. The name and the ID of the item are saved in a Spreadsheet document. Works with one file...but I want to upload ...
I am following a tutorial [here][1] to make a Facebook like friend tagging system. But the tutorial lacks the "arrow navigating" capability like Facebook. I would like to figure out how to achieve ...
I am following a tutorial [here][1] to make a Facebook like friend tagging system. But the tutorial lacks the "arrow navigating" capability like Facebook. I would like to figure out how to achieve ...
I am using Trisquel 7.0. I've some basic knowledge about html and JavaScript. Now I want to save html form data to file (Also interested in loading/filling html form from file). I searched and found ...
I am using Trisquel 7.0. I've some basic knowledge about html and JavaScript. Now I want to save html form data to file (Also interested in loading/filling html form from file). I searched and found ...