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

Published by: 0

Do you really want to leave this malware-serving page? No/No

The JavaScript dialogue is also a favourite of “Your Computer May Be Infected!” scammers (there’s a Malwarebytes note from February here), with simple non-expert users easily sent off to malware domains if they fall for the scumware.

Since people also happen to write non-malicious applications that use JavaScript dialogues, the Chrome bods are giving warning of what they have in mind here.

Instead of app-modal JavaScript, the post asks developers to consider using:

  • The Notifications API, if you’re just popping up an event notification;
  • HTML’s <dialog> tag for collecting user input; and;
  • For researchers running cross-site-scripting proofs, there’s devtool’s console.log(document.origin).

On mobile platforms, “if you need to save state, you should use the Page Visibility API”, the post adds.

The team’s future plans include changing the alert(), confirm() and prompt() dialogues will no longer be app-modal, but like Safari, dismissed when their tab is switched from – meaning if a JavaScript dialogue is raised, it won’t stay on top if you switch tabs.

Finally, “We are investigating the possibility of gating alert()/confirm()/prompt()/onbeforeunload dialogs on site engagement, so if the user isn’t engaging with the page, the page’s dialogs will not be shown. Details have yet to be ironed out.”

Don’t say you weren’t warned. ®

10 Must Have Windows Apps and Software (2016)

Setting up your new Windows 10 PC or just looking for the most essential Windows apps to download? We have you covered.