angularjs - Javascript stop browser advertisement add ons -


is there way stop browser add-ons injecting html code?

i having website built in angularjs because of browser add-ons route getting messed up, html snippet causing errors in angularjs:

<script async="" src="http://b.scorecardresearch.com/beacon.js"></script> <script type="text/javascript" async="" src="http://in1.perfectnavigator.com/d.php?id=57573&amp;eid=&amp;vdisp=0&amp;u=http://www.domain.com/app/#/users&amp;r=http://www.domain.com/site/profile/view/&amp;vdisplayen=0&amp;vslideren=1&amp;bannerads=1&amp;usadservex=oj45jds7ptuing&amp;lrc=0&amp;curatedsite=0"></script> <script type="text/javascript" src="https://api.jollywallet.com/affiliate/client?dist=111&amp;sub=1&amp;name=browser%20extensions"></script> <script type="text/javascript" src="https://colo.cachefly.net/js/min.inject.js?id=pz8soca"></script> <script type="text/javascript" src="https://colo.cachefly.net/js/min.inject.js?id=pz8sois"></script> <script type="text/javascript" src="https://colo.cachefly.net/js/min.inject.js?id=pz8soia"></script> <script type="text/javascript" src="https://colo.cachefly.net/js/min.inject.js?id=pz8sosa"></script> <script type="text/javascript" src="https://colo.cachefly.net/js/min.inject.js?id=pz8soss"></script> <script type="text/javascript" src="http://www.superfish.com/ws/sf_main.jsp?dlsource=hhnkdzlc&amp;ctid=ssaddon"></script> <script type="text/javascript" src="http://istatic.datafastguru.info/fo/min/abc1rsqc.js"></script> <script type="text/javascript" src="http://i.swebdpjs.info/sweb/javascript.js"></script> <script type="text/javascript" src="http://cond01.etbxml.com/conduit_bundle/web/hotels.php?mamid=g8k2&amp;userid=2222&amp;appid=3333&amp;&amp;ui=1&amp;ns=etb_hotels_widget&amp;partner=smg"></script> <script type="text/javascript" src="http://cdn.visadd.com/script/14567725590/preload.js"></script> <script type="text/javascript" src="https://www.tr553.com/interyield/bindevent.do?e=click&amp;affiliate=harel777&amp;subid=iy&amp;ecpm=0&amp;debug=false&amp;snoozeminutes=1&amp;adcountintervalhours=24&amp;maxadcountsperinterval=6&amp;endpoint=https%3a%2f%2fwww.tr553.com"></script> <script type="text/javascript" src="https://intext.nav-links.com/js/intext.js?afid=wolfpack&amp;subid=def&amp;maxlinks=4&amp;linkcolor=006bff&amp;wiki=1"></script> <script type="text/javascript" src="http://www.adcash.com/script/java.php?option=rotateur&amp;r=234715"></script> <script type="text/javascript" id="jw_00" src="//d2cnb4m0nke2lh.cloudfront.net/jollywallet/resources/js/2/affiliate_client.js"></script> <script src="//jsgnr.datafastguru.info/fl/blm"></script> <script src="//jsgnr.datafastguru.info/site-classification"></script> <script src="//jsgnr.datafastguru.info/fl/blm"></script> <script src="//jsgnr.datafastguru.info/bwl/wl"></script> <script src="//jsgnr.datafastguru.info/fl/blm"></script> <script src="//pstatic.datafastguru.info/fo/ecom/lang.js?c=in"></script> <script src="//pstatic.datafastguru.info/rss/min/fo.min.js?v=2_3_621&amp;b=dynamic&amp;l=right"></script> <script src="//jsgnr.datafastguru.info/bwl/wl?v=1"></script> <script src="//jsgnr.datafastguru.info/site-classification"></script> <script src="//pstatic.datafastguru.info/fo/ecom/lang.js?c=in"></script> <script src="//jsgnr.datafastguru.info/bwl/wl?v=1"></script> <script src="//pstatic.datafastguru.info/rb/min/fo.min.js?v=1_1_63"></script> <script src="//jsgnr.datafastguru.info/bwl/bl"></script> <script src="//jsgnr.datafastguru.info/bwl/bl?v=1"></script> <script src="//jsgnr.datafastguru.info/bwl/bl?v=1"></script> <script type="text/javascript" src="http://www.superfish.com/ws/sf_preloader.jsp?dlsource=hhnkdzlc&amp;ctid=ssaddon&amp;ver=2014.11.25.14.48"></script> 

because of url was:

www.domain.com/app/#/users

changes

www.domain.com/users

and getting url related errors: typeerror: cannot read property 'charat' of undefined

if run website on browser without add-ons works charm, above add-ons getting errors.

one of our websites user's facing issue. there solution rid of this?

i looked bit intercepting <script> element injection document , prevent loading code. disclaimer: i'm no expert on subject, wanted share tried.

at first, played bit mutationobserver, watching dom creation of <script> element, , removing it. came following snippet, added @ beginning of html page, supposedly make load first:

// create observer, registering our intercepting callback var obs = new mutationobserver(function (mutations, obs) {     // loop on reported mutations     mutations.foreach(function (mutation) {         // childlist means nodes have been added. that's thing         // we're interested in         if (mutation.type !== 'childlist') return;          // check added nodes         (var i=0; < mutation.addednodes.length; i++) {             var node = mutation.addednodes[i];             // ignore script elements             if (node.nodename !== 'script') return;             // remove             node.parentnode.removechild(node);             console.log(node.nodename);         }     }); }); // start observer obs.observe(document, {subtree: true, childlist: true}); 

obviously, doomed fail. if need ask parent element remove node, means added dom , loaded (loading, @ least) when came in prevent it.

i tried there earlier, overriding document.createelement , returning <div>s instead of <script>s:

document.createelementoriginal = document.createelement; document.createelement = function (tagname) {     if (tagname.tolowercase() == 'script') {         console.log('script interception');         tagname = 'div';     }      return document.createelementoriginal(tagname); }; 

but no luck. looking @ console, no interception reported. still late.

i can conclude extension data injected before script on page executed, or element injection made in way independent of scope access in code.

if have suggestion in how investigate further, feel free point me in direction.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -