Why does alert box closes automatically on Chrome tab (window) change? - javascript

Whenever a normal alert box displays on a Chrome tab, it disappears when you switch the tab (ok is triggered automatically). Not the same behaviour on Firefox. I am wondering why? Didn't find any answers... Thanks.

Duplicate? Javascript : Alert Box dismissed when tabs switched
From Google: "This is working as intended, see Issue 629964 . It's not a security bug; a user could make the dialog box disappear with developer tools or myriad other tricks as well."

Related

How to prevent Google chrome from suppressing confirm() dialog

the new version from google chrome does not allow confirm dialog if the window is not active.
I have a page which is calling a popup. The popup has a button. on click of that button, a javascript function of parent page will be called . the javascript function has a confirm dialog.
after chrome update to Version 69.0.3497.100 (Official Build), this is not working any more with following warning.
"A window.confirm() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5140698722467840"
try this [jsfiddle]: https://jsfiddle.net/VikasUpadhyay/47vurfm0/6/

Javascript - how to not dismiss an alert/confirm window by clicking outside of it?

My Mobile Web Application has an option to enter the developer settings by clicking 6 times in a row on app logo on the top of the display.
Procedure is almost identical to enabling developer settings on Android.
After clicking 6 times, an alert opens up with the information about developer settings being enabled.
However, when a developer wants to enable those settings, he clicks on the logo without counting. The alert window is dismissed almost instantly since it appears after 6 clicks; but 7th click comes really quickly after 6th so the developer can't see the alert appropriately.
How can I make the alert window not dismissed after clicking outside of it? So the developer actually has to press 'OK'?
Simple, you cannot...
You have to emulate this behavior with a DOM Dialog

Javascript : Alert Box dismissed when tabs switched

How not to allow Alert Box to be dismissed when tabs switched.
Using alert("Test"); on Google Chrome, when you switch tabs, the alert dialog box disappears, and when you're back on the same tab you have full access.
What I want is to do the same thing as stackoverflow website when you create a question and try to close the tab, there's a dialog box that pops up that doesn't allow you to go anywhere until you choose between (Leave or Stay).
IE and Firefox work differently, I mean block the tab when using alert("Test"); statement but Google Chrome doesn't block.
I sent a bug report to Google but they replied to me that :
This is working as intended, see Issue 629964.
It's not a security bug; a user could make the dialog box disappear with developer tools or myriad other tricks as well.
I was able to get around this issue by calling my javascript alert in an iframe
I would like to point out that this appears to have reached a compromise; current (Version 110.0.5481.104 (Official Build) (64-bit)) shows alert() and confirm() on the tab, but do not prevent going to another tab.
When user returns to the original tab - the message box is still there waiting for them.
So this allows persistence, without "hijacking the browser". :)

Process Javascript in inactive tab on iPad

I have this solution that takes the user through a series of questions. At the end the user can click a button that opens a new window with a form to enter contact info. The population of this popup window is done through JavaScript from the calling window.
The process (in JS) is this:
Open popup window with loading gif
Store additional information remotely through ajax
Populate popup window with contact form
This all works fine in desktop browsers but not on iPads (using Safari where all windows are displayed as tabs). I have a suspicion that the JavaScript in the parent tab is halted when the "popup" tab gets displayed. To support this theory I can actually get the popup tab populated if I switch back to the parent tab immediately after the popup tab is displayed.
Can anyone confirm this? And of course if there's a solution I would very much like to hear about it.
Needless to say it works like a charm on my Android tablet :-)
Try using window focus and blur to activate some javascript when the focus is back on your tab.
See: https://stackoverflow.com/a/3479936/1712686

Why doesn't "Share on Twitter/Facebook" box appear upon click of Disqus "Like" button when using IE7?

Beneath any article with Disqus embedded, there is a Disqus "Like" button which should produce a box asking "Glad you liked it. Would you like to share?"
See, for example, http://www2.hedgeye.com/newsletter/14299-pax-canadiana.
Our problem is that when using IE7, the aforementioned "Share" box doesn't appear. We use Airbrake (formerly Hoptoad) for bug reporting, but no bug corresponding to this showed up there.
We tried changing the user agent in Safari to IE7 to see whether Disqus is set up to respond to IE7 that way. But when we clicked the "Like" button, the "Share" box did appear.
No script errors are reported by IE7 in the JavaScript console when the button is clicked.
What could the problem be?
What else might we test to discover the problem?

Categories

Resources