Open url on a new tab page based on JavaScript implementation

  • 2021-07-09 06:34:31
  • OfStack

When window. open (url, "_ blank") is invalid, the following methods can be used.


function openwin(url) {
var a = document.createElement("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
a.setAttribute("id", "camnpr");
document.body.appendChild(a);
a.click();
}

Related articles: