One of my pet peeves while using Chrome is when I’m listening to something in a browser tab, working in another one and then decide to close the current one. I press Alt+F4 instead of control F4 and my audio stream is interrupted.
Sure, you can relaunch Chrome and then press Control+Shift+t to regain all of your tabs, but you still have to find your spot in the audio stream.
Well, I’ve devised a little JAWS script and figured I’d share it here. Yes, I know that Edge has this built-in to their browser, but I tend to like Chrome
better… and I like tinkering with code.
So here are the steps:
- Launch the JAWS script editor while you’re in a Chrome window with Insert+0 on the number row.
- Press control+end to get to the bottom of the script file.
- Press Control+E to create a new script.
- Type in a name for the script, something like PreventsClosing and press Tab. Note, this edit box does not accept spaces, so use capitals if you like.
- Check the box that says: Can be attached to key, and press Tab.
- Type in what ever you want in the Description and Synopsis edit boxes.
- Tab through to the Assign to hotkey area. Press Alt+F4. The window won’t close on you. Instead the key sequence will be copied to this field.
- Tab to okay and press Enter.
- Now you are ready to copy the code below:
button = ExMessageBox (“ARE you sure?”, “Close Chrome”, MB_YESNO|MB_DEFBUTTON1)
if button == 6
Once you copied the above code, press control+s and the script will be compiled.
Press Alt+f4 to close.
You can now test your modifications by pressing Alt+f4 in Chrome.
A message window will popup asking you if you really want to close Chrome.
Press Enter on yes and it will proceed. Otherwise, choosing the no button will keep you in Chrome.