Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24139
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!mit.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Simon Lewis <simonlewis2001@gmail.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: intercept an alert |
| Date | Mon, 12 May 2014 12:29:36 +0200 |
| Organization | Lewis |
| Lines | 32 |
| Message-ID | <8761lb47e7.fsf@gmail.com> (permalink) |
| References | <862dneogqrcsze3OnZ2dnUVZ_gCdnZ2d@westnet.com.au> <raKdnSsnnK2Ow-3OnZ2dnUVZ_sadnZ2d@westnet.com.au> <3910370.hJEAF5dPUy@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | mit.eternal-september.org; posting-host="1ee1c920522f5180c3b02b9a2b32cdda"; logging-data="12164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195MCwfgNa6+sC6qX7fwjNInyYoTl0OgDA=" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| Cancel-Lock | sha1:/IDmZa9pMbjG/Y0de0DpVE8Opzw= sha1:kCsUWjVBlMA4kznzGkZDYFH/y8I= |
| Xref | csiph.com comp.lang.javascript:24139 |
Show key headers only | View raw
Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
> Andrew Poulos wrote:
>
>> if (!window._alert) {
>> window._alert = window.alert;
>> }
>>
>> window.alert = function(msg){
>> if (msg.indexOf('is empty') != -1) {
>> return false;
>> } else {
>> return window._alert.apply(this, arguments);
>> }
>> };
>>
>> Is this the way to go?
>
> Not quite. You should not augment the host object referred to by “window”
> with an “_alert” property (modifying its “alert” property is bad enough, but
> I cannot see a better alternative here). Use a variable or a property of
> your own object instead.
Nonsense.
It's perfectly fine to do that.
People tag things on to "window" in each and every JS project.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
intercept an alert Andrew Poulos <ap_prog@hotmail.com> - 2014-05-12 14:38 +1000
Re: intercept an alert Andrew Poulos <ap_prog@hotmail.com> - 2014-05-12 15:35 +1000
Re: intercept an alert Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-12 11:32 +0200
Re: intercept an alert Simon Lewis <simonlewis2001@gmail.com> - 2014-05-12 12:29 +0200
Re: intercept an alert Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-12 13:30 +0200
Re: intercept an alert "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-05-12 14:54 +0200
Re: intercept an alert "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-05-12 15:36 +0200
Re: intercept an alert Simon Lewis <simonlewis2001@gmail.com> - 2014-05-12 15:40 +0200
Re: intercept an alert Simon Lewis <simonlewis2001@gmail.com> - 2014-05-12 15:43 +0200
Re: intercept an alert "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-05-12 16:19 +0200
Re: intercept an alert Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-12 19:35 +0200
Re: intercept an alert garrett.smith@acxiom.com - 2014-05-14 09:57 -0700
Re: intercept an alert Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> - 2014-05-13 18:00 +0100
Re: intercept an alert garrett.smith@acxiom.com - 2014-05-14 09:57 -0700
csiph-web