...

View Full Version : How I can automatically close the alert box as soon as it appears



ankit.pandey3
09-17-2011, 12:55 PM
Hi friends....
I have an alert message just like



alert("Hiii");



I want to close it automatically as soon as it appears.
It means I don't want to show this alert message to client.
Can anyone tell how i can do it???
Please help me......
Thanks in advance....

sunfighter
09-17-2011, 03:46 PM
I don't want to show this alert message to client.

Why not just comment this line out? Then you can add it back when needed.

ankit.pandey3
09-18-2011, 07:21 AM
Why not just comment this line out? Then you can add it back when needed.

Actually I use alert to just flash my task bar when it is not active. So, i can't remove it but i don't want to show it to user.
Is there any way that it closes automatically....

DaveyErwin
09-18-2011, 07:38 AM
Actually I use alert to just flash my task bar when it is not active. So, i can't remove it but i don't want to show it to user.
Is there any way that it closes automatically....

Try replacing alert with
window.blur();window.focus();
Maybe that will "flash your task bar" .

ankit.pandey3
09-18-2011, 11:04 AM
Try replacing alert with
window.blur();window.focus();
Maybe that will "flash your task bar" .

Thanks for reply friend but window.blur();window.focus(); not works. Any other idea to blink taskbar??

Old Pedant
09-18-2011, 10:05 PM
Blink something else, instead.

For example, put a <div> at the bottom of your page and change its background color, briefly, as a "blink".

ankit.pandey3
09-19-2011, 11:36 AM
Blink something else, instead.

For example, put a <div> at the bottom of your page and change its background color, briefly, as a "blink".

I think it works only when window is active but not when it is minimized.

blaze4218
09-19-2011, 04:30 PM
I don't think that alert has any such methods for closing it through script, but here's a possible out-of-the-box solution for your out-of-the-box question...

If you enable your browser to warn of script errors (and I'm only sure of this working in IE) then you could put a harmless error in your script, that doesn't effect performance, at the time the alert is supposed to fire. Almost nobody except developers have "show script errors" enabled, so they won't see it. So I guess if there are no other errors on your page that could possibly give you a false positive, that might actually work.

What I do when I want to add special features to my site that only apply to me is use cookies to identify myself and only enable those features (usually for debugging) when my cookie is active.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum