javascript - Reference return by window.open() is Undefined in Edge browser -


the following code isn’t working edge though works other browsers.

function postlink(locn, trgt) {    = document.createelement("a");    a.id = 'link';    a.targt = trgt;    a.href = locn;    var newwin = window.open(a);    newwin.opener = newwin;  }
<a onclick="postlink('http://www.google.com','_blank');return false;">clickme</a>

it gives newwin undefined. whereas, window.open() works edge. explanation / appreciated.

from window.open() docs:

syntax: window.open(url,name,specs,replace)

http://www.w3schools.com/jsref/met_win_open.asp

so, why not simplify code this:

<a onclick="window.open('http://www.google.com','_blank');">clickme</a> 

https://jsfiddle.net/3aaljjoh/


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -