0👍
Ok I found a way to do it on my desktop by using the following code :
var
is_asked = false;
window.onbeforeunload =
function (ev) {
var e = ev || window.event;
window.focus();
if (!is_asked){
is_asked = true;
var showstr = "CUSTOM_MESSAGE";
if (e) { //for ie and firefox
e.returnValue = showstr;
}
return showstr; //for safari and chrome
}
};
window.onfocus =
function (ev){
if (is_asked){
window.location.href = "http://localhost:8080";
}
}
But still no luck on my mobile….
when I use safari on my desktop it works well but when I use safari on mobile I get a blank page again. I think there is something related to window.onbeforeunload not supported by mobile?
- [Vuejs]-BootstrapVue control columns number in form group
- [Vuejs]-Nuxtjs issue with IE11 compatibility_ object assign
0👍
I fixed the issue by using localstorage.
Instead of redirecting to the Home page I stored the form data on the localstorage and everything is fine now – https://www.npmjs.com/package/vue-localstorage
- [Vuejs]-How we can reverse and remove the same message with to different buttons with VueJS?
- [Vuejs]-How can I import a JS file from a folder in my Vue JS project?
Source:stackexchange.com