Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: restore window alert Date: Sun, 11 Sep 2016 13:24:57 +0200 Organization: PointedEars Software (PES) Lines: 83 Message-ID: <19142186.EfDdHjke4D@PointedEars.de> References: <18kx87e56fmrr.u0ghv1tkc6cu.dlg@40tude.net> <92e03e5f-e115-40d1-ba94-4b34459d8c14@googlegroups.com> <1760285.oMNUckLgyt@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1473593098 12717 eJwFwYEBwCAIA7CXBqVgz3Gg/59gQqRlVyQzeHm3nW9cquPrQAp6gKsNitqtXIYfqJ1DjdcDAyQP/A== (11 Sep 2016 11:24:58 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sun, 11 Sep 2016 11:24:58 +0000 (UTC) User-Agent: KNode/4.14.2 X-NNTP-Posting-Host: eJwFwQkBwDAIA0BLfAlUTunAv4Tdwal8GQQDi43EXZv6fA5rpab9kWEqi0ht9Tbg5mmKlv0T+xBF Cancel-Lock: sha1:c/pkcQZcMGbf2k7m7L6BYmziYtA= X-User-ID: eJwFwQEBwCAMAzBL9LQdyNmA+ZfwRNPwCVqmWv06RiSXsGbVVylmI1R8uJ49zkkI2lGlKzufm5cYXNTGD1apFSo= Xref: csiph.com comp.lang.javascript:31320 Andrew Poulos wrote: > This in Edge when run locally > > > > > > Alert > > > >

Hey

> > > > results in a new tab being opened and closed but no alert box appearing. Different problem; I did not say “window.setTimeout”. Also, you want to use the module pattern. But Edge 25.10586.0.0 on Windows 10 Enterprise Evaluation, Version 1511, Build 10586.164, at least does have the problem that you cannot call the transferred “alert” method: you get “Invalid calling object” when you try. Internet Explorer 11.162.10586.0 behaves differently there: Depending on whether you close the popup before calling its alert() or afterwards, you get either “Invalid calling object” or “Function expected” or nothing. I might look into this further when I am back in the office: debugging Edge/IE 11 on Windows 10 in VirtualBox on OS X via TeamViewer is a PITA. For now, something along the lines of var iframe, w, d, b; var _alert = (typeof document.createElement != "undefined") && (iframe = document.createElement("iframe")) && (iframe.style.display = "none") && (b = document.body) && (typeof b.appendChild != "undefined") && (b.appendChild(iframe) || true) && ((w = iframe.contentWindow) && w.alert || (d = iframe.contentDocument) && (w = d.defaultView) && w.alert)) || (function () { var w = window.open("", "w" + new Date().getTime(), "width=1,height=1"); if (!w) return null; var local_alert = w.alert; w.close(); return local_alert; }()); if (_alert) { window.alert = _alert; window.alert(42); b && b.removeChild(iframe); } is probably the safest bet. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.