Skip to content

nathanhleung/extension-warn-before-closing-canvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Icon

Warn Before Closing Canvas

Have you ever had an insightful comment typed up as a Canvas discussion post response but then you accidentally closed the tab and lost your post?

Insightful Comment

This extension warns you before you close any Canvas tab (i.e. any tab on a site that matches *.instructure.com/*discussion_topics*) so this hopefully doesn't happen to you again.

Warning

Code

This extension is 7 lines of code long:

// From https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#example
function onBeforeUnload(e) {
  e.preventDefault();
  e.returnValue = "";
}

window.addEventListener("beforeunload", onBeforeUnload);

About

Chrome extension that warns you before closing Canvas

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published