Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29161

Re: Catching http request with JavaScript

Path csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail
From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Catching http request with JavaScript
Date Thu, 7 Jan 2016 13:49:40 +0100
Organization albasani.net
Lines 21
Message-ID <n6lmt5$vb9$1@news.albasani.net> (permalink)
References <568e31ca$0$19736$426a74cc@news.free.fr>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net DD2cpcCGHWv5KLLYxOoOVovC1svPW+LET748azJueMXSM3RQz8uZYI4ioLuhqRhFAQ0PYjMdk/MVHcB6oNhiyA==
NNTP-Posting-Date Thu, 7 Jan 2016 12:49:41 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="t+R7j0AaSYdhjuaIT5ci+a7Pm/7dIo3ORFvI1wH6fgK2qeXvNiP/BensTwndcgD7EMThEVG3BhaIDki8hCeiuegQ9BskNWAj9x559rIXXpJqPY2Uo7hsOYn9lhko3RCj"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
In-Reply-To <568e31ca$0$19736$426a74cc@news.free.fr>
Cancel-Lock sha1:2Tnf1NYDdDkHSLelCo5MCHRnvm0=
X-Enigmail-Draft-Status N1110
Xref csiph.com comp.lang.javascript:29161

Show key headers only | View raw


On 01/07/2016 10:36, mireero wrote:
> Some addons like adblocks, ghostery... are using some browser specific
> functionalities to "regular expression block" some specific http requests.
> 
> Is there any cross-browser way of achieving something similar using
> regular JavaScript?

Not directly; the API required for that is not available in regular
documents. But you can always write a simple extension yourself, or add
custom user scripts with GreaseMonkey (on Firefox) or TamperMonkey (on
Chrome).

> For example I'd like to block some <img> tag or to modify on the fly
> involved request headers.

If you know the source location, you can just block an image with an ad
blocker. Other than that (depending on your requirements), a local
filtering proxy may be useful. Some desktop firewalls also have the
ability to filter/modify requests.

- stefan

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Catching http request with JavaScript mireero <mireero@free.fr> - 2016-01-07 10:36 +0100
  Re: Catching http request with JavaScript Tim Streater <timstreater@greenbee.net> - 2016-01-07 09:44 +0000
  Re: Catching http request with JavaScript Stefan Weiss <krewecherl@gmail.com> - 2016-01-07 13:49 +0100
  Re: Catching http request with JavaScript JJ <jj4public@vfemail.net> - 2016-01-08 13:08 +0700

csiph-web