back to article Web-app devs note: Google wants to banish JavaScript dialogues

Annoying sites that open hard-to-eradicate “Do you want to leave this site? Are you sure?” dialogues are in Chrome's cross-hairs: the Chrome team has decided JavaScript dialogues offer too much scope for abuse, and is laying out a roadmap to get rid of them. The JavaScript dialogue is also a favourite of “Your Computer May Be …

  1. Kevin McMurtrie Silver badge
    Windows

    The "Chrome Team" is saying this because

    Google can't delete the 90% of their Play Store inventory that is serving up fraudulent full-screen ads masquerading as a running application to hijack user input.

    Time to reassign the Special Brew guy icon to Google.

  2. Anonymous Coward
    Anonymous Coward

    How about we eliminate this on mobile devices first

    For a while last summer, it seemed like about every tenth link I saw shared on Facebook would take me to a page about having 'won' something. If it was something I really wanted to see, I'd have to go back to it 3 or 4 times before I'd get lucky and avoid it. Since it happened across many sites, most of which were reputable, I figure it had to be ads that were abusing Javascript.

    I still see it once in a while, but not nearly as bad. Not sure if Google or whoever sold those ads addressed it with their clients, or Apple made some changes in Safari with iOS 10 that made it more difficult to do, or Facebook somehow cracked down on it. But it still happens once in a while. It shouldn't ever be allowed to!

    1. Brewster's Angle Grinder Silver badge

      Re: How about we eliminate this on mobile devices first

      I imagine those ads are inside the document tree and won't get eliminated. All they're doing is controlling application modal dialogs that exist as separate windows and that---on Chrome and Edge---prevent you changing tabs. (On Firefox, I can change the tab with one open. But I have the tree tab plugin so that may be interfering with them.)

      To see one in action, open your browser, hit F12, pick the console tab, and type alert("hello world")⏎

  3. Ken Hagan Gold badge

    What took so long?

    I don't think I've ever seen a legitimate use of such dialogs. I can think of one site where it is merely an annoyance. Every other site I can think of that has ever used a popup dialog has been trying to serve up malware.

    In fact, I'd be happy for my browser to "implement" such requests by immediately closing the web page that issued it and black-listing the domain. I'm sure that my one legitimate use would quickly re-code their site.

    1. Wade Burchette Silver badge

      Re: What took so long?

      I have seen plenty of legitimate uses for the alert/confirm/prompt dialogs. Better websites now use something like JQuery UI's modal dialog boxes. If you are coding, these dialog boxes can help bridge a gap until you do implement a better dialog box. I use them as fillers when I am working on something, such as when you click on a button I haven't implement yet and you get an alert that says "later", which lets me know my code is working up to that point.

      I like the way FireFox implements them. If a dialog box appears more than once, you can check a box to suppress them all until a page refresh.

  4. Dr Who

    What about applications

    In a browser based application there's often a genuine case to use a beforeunload confirm if for example the user has not saved some changed data.

    1. James 51

      Re: What about applications

      I was thinking that, sometimes alerts are generated from within the code. Of course that's our in house apps, not general usage websites.

    2. Matthew Brasier

      Re: What about applications

      That should be fine though, the proposal isn't talking about getting rid of the ability to create dialogues, its talking about getting rid of the ability to create dialogues that you must interact with before you can do anything else.

      You can still pop up a dialogue asking if the user wants to save what they were working on, you just can't force the user to interact with it.

  5. -tim
    Flame

    About 20 years too late...

    Who ever thought it would be a good idea to have those boxes pop up with out the normal OS related "close this thing" working as "cancel"? That person should be found, named and shamed and every other feature they added to JavaScript should also be purged in a fire.

  6. Mage Silver badge
    Flame

    Arrogant

    They might be right, but Chrome is NOT in charge of the Internet standards.

    ANYTHING can be misused to do malware. The greatest evils are:

    1) Multiple third party domains, rather than domain of web page hosting all scripts

    2) Javascript in adverts (see point 1). They should be a static image.

    3) Tracking

    I don't see how switching dialogues from Javascript to HTML solves anything.

    1. richardcox13

      Re: Arrogant

      Exactly. They're doing exactly what everyone complained about Microsoft doing.

      The alternatives are not equivalent and bring their own problems (one being cross browser compatibility).

  7. Joe Drunk

    onbeforeunload dialogues are the second most annoying internet annoyances

    second only to auto-play video ads. Thankfully the Tampermonkey extension has a disable-onbeforeunload script which eliminates those dialogues.

    1. Daggerchild Silver badge
      Flame

      Re: onbeforeunload dialogues are the second most annoying internet annoyances

      Fullscreen animated ads for me. And background fullscreen video. I cannot even.

      "I have a great idea, if we cripple the user's browsing experience, they'll *definitely* pay attention to us!"

      "It looks good on my superpowerful high bandwidth desktop next to the image servers - let's do it!"

  8. Anonymous Coward
    Anonymous Coward

    I'm ok with just one "Leave this site?" question. But the problem is when you press "Yes/Leave" you're sometimes taken not to the previous site but to a new site. It'll happen again and again. If you check history right clicking the back button you'll see it is full of fake visits so going back isn't gonna work. Try to fix this.

    -Tested on Opera(Chromium)

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2021