Created
December 6, 2019 00:29
-
-
Save mgd020/5d73d2c901b3e41364893488521ac467 to your computer and use it in GitHub Desktop.
Override print dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function forceOpen() { | |
var url = "http://www.google.com"; | |
window.open(url) ? location.reload() : (location.href = url); | |
} | |
window.addEventListener("beforeprint", function (e) { e.preventDefault(), forceOpen() }) | |
window.matchMedia("print").addListener(function (e) { e.matches && forceOpen() }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment