Chrome Reminder Extension
August 14, 2014 5:17 PM   Subscribe

Chrome Extension: I'm looking for an extension that will remind me to complete a checklist before leaving a web page.

I need a Chrome extension (or something similar) to initially block me from browsing away from a certain web page.

Sounds crazy, right? Here's the situation...

Let's say there is a specific website that I visit a lot. On that website, I'm processing widgets. Each widget has it's own page on the site. For example:

When I'm viewing a particular widget's page, and I then try to browse AWAY from that specific widget's dedicated page, I'd like Chrome to say, "Hey! Before you leave, remember that you need to do X, Y, and Z." It's just a one-time pop up, that I can easily dismiss.

In this example, X, Y, and Z are things that don't involve directly interacting with the widget website. For example, X might be "manually update an external database" or "manually add an event to a calendar."

Bottom-line: I want Chrome to show me a reminder before I browse away from any page at a certain domain.

Man, as I type that, it sounds insane. Any ideas?
posted by JPowers to Computers & Internet (4 answers total)
Best answer: Hm. A bit peculiar, but not insane. Still, easy enough request. You'll need to install Tampermonkey for Chrome which will allow you to install userscripts, and then you'd create a userscript (TampermonkeyMenu > Add a new script...). Then, copy and paste the script below, make the changes to match your site, save the script (use the save button in the toolbar), enable the script (either via the tampermonkey menu when you visit the site, or via the dashboard) and viola.

Here's the script you'd want to use:
// ==UserScript==
// @name        Confirm navigate away
// @namespace
// @include*
// @version     1
// @grant       none
// ==/UserScript==

// Replace the @include statement above with the URL you want to match

window.onbeforeunload = function () {
    // Replace the text below with the reminder you want to show.
    return "Remember to do x y and z!"

posted by Aleyn at 8:12 PM on August 14, 2014

Response by poster: @Aleyn

This is awesome! Thanks. I've got it up and running, and it's exactly what I was looking for. Thanks.

One question: In the pop-up, is there any way to customize the two buttons that appear? Can I change their display strings? Can I take the focus off of one (I want to make it harder than just clicking enter to dismiss the message)?

Thanks again! Dope!
posted by JPowers at 8:53 PM on August 14, 2014

Ah, I'm afraid not. I can go into the technical details if you want them, but basically the browser only lets scripts inform it when it needs to show a message before navigating away and doesn't allow more customization of the dialog other than the message as a security measure. (Incidentally, Firefox is worse and doesn't even show the message, just a generic dialog, but since you're using Chrome you're fine.)

If this were a fully-fledged extension rather than a userscript, it's possible that one could write an extension that interacts with the page that way, but I'm not familiar enough with the Chrome extension APIs to know what that would look like.

Sorry about that. Hopefully this will work well enough for you, though. :)
posted by Aleyn at 11:27 PM on August 14, 2014


I've just found this thread because I have a very similar need. Instead of a script that displays a reminder when leaving a webpage, I need a script that displays a reminder when visiting a webpage.

I was hoping it would be as simple as replacing the "window.onbeforeload" with "window.onload" but that doesn't seem to work.

If anyone could help me out I'd really appreciate it. Thanks!
posted by aicccia at 12:42 PM on August 20, 2014

« Older PC not booting, not sure wher to start with...   |   Very thick antifatigue mat for standing desk? Newer »
This thread is closed to new comments.