S
S
SilentImp2011-05-24 13:51:13
JavaScript
SilentImp, 2011-05-24 13:51:13

How to "mute" js errors from external elements on the site (counters, Facebook blocks, affiliate programs, etc.)?

Have a nice time of the day.
Affiliate blocks are inserted on the site. These blocks, as a rule, must be installed as is, otherwise the resource can be banned in a banal way.
Or let's say facebook blocks.
All this generates a lot of errors, not in one browser, so in another (very impressive throwing facebook like/recommend box errors in ie6).
Is there a unified way to catch and suppress errors that are generated by such alien blocks so that you don’t litter the debugger console and ie6 users don’t get error messages?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nkid, 2011-05-24
@nkid

window.onerror can be used to silence errors, and the location of the error can also be found from the parameters.

K
Konstantin, 2011-05-24
@Norraxx

try{
facebook_code...
}catch (err) {
...
}

S
SilentImp, 2011-05-24
@SilentImp

Norraxx, Facebook code looks like
<fb:recommendations site="zn.ua" width="300" height="300" header="true" font="" border_color="#fff"></fb:recommendations
> intercepting with try/catch is somewhat difficult in such a connection

S
SilentImp, 2011-05-24
@SilentImp

the code got cut, my apologies
[script src="http://connect.facebook.net/en_US/all.js#xfbml=1"] [/script] <fb:recommendations site="zn.ua" width="300" height="300" header="true" font="" border_color="#fff"></fb:recommendations>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question