Reputation: 1
We are currently having an issue with Chrome.
We have a VOIP system which opens a tab in the users browser when a person calls in (it grabs the number an queries the database)
The problem we have is the focus goes to the new tab and interrupts the tab the user is currently on.
We are assuming the VOIP system is using window.open however they are not very helpful so need to come up with a solution without our system
Upvotes: 0
Views: 875
Reputation: 52
function createAndOpenSlientTab(link){
var a = document.createElement("a");
a.href = link;
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,
true, false, false, false, 0, null);
a.dispatchEvent(evt);
}
Usage:
createAndOpenSlientTab("https://stackoverflow.com");
Upvotes: 1