Created
October 29, 2019 02:24
-
-
Save mgd020/f4d3e72ed38c0a76cf21f76b51a430b5 to your computer and use it in GitHub Desktop.
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