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


Groups > comp.lang.javascript > #29161

Re: Catching http request with JavaScript

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Catching http request with JavaScript
Date 2016-01-07 13:49 +0100
Organization albasani.net
Message-ID <n6lmt5$vb9$1@news.albasani.net> (permalink)
References <568e31ca$0$19736$426a74cc@news.free.fr>

Show all headers | 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