JSFiddle - React, Tailwind, and code Playground
by gion_13
HTML
<a href="http://yahoo.com">try it</a>
JavaScript
// use a closure so you don't pollute the global ns
(function(){
var message = 'don\'t go!',
// the function that redirects the page to a certain url
redirect = function (url){
document.location.href = url;
}
window.onbeforeunload = function() {
setTimeout(function() {
window.onbeforeunload = function() {};
setTimeout(function() {
redirect('http://heeeeeeeey.com/');
}, 100);
},1);
return message;
}
})();