I'm facing an issue while working with Vue.js. I have been trying to create a function that opens a new window in Chrome and captures the onclose or onbeforeunload event of that window from the same Vue component where it was opened. Here is how I tried to implement it:
...
methods: {
gitConnet(){
var child = window.open("https://www.google.it", '_blank', 'fullscreen=no,height=600,width=800,top=100,location=no,titlebar=0');
child.onclose = function(){ console.log('Child window onclose closed'); };
child.onbeforeunload = function(){ console.log('Child window onbeforeunload closed'); };
}
}
...
Although this code successfully opens the new window, I'm not seeing any message in the console when I close the window. I even attempted to store the child variable in the data property of the component, but it didn't make any difference.
If anyone could assist me in capturing the onclose event of the window within the Vue component, I would greatly appreciate it.
Thank you in advance.