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&eid=&vdisp=0&u=http://www.domain.com/app/#/users&r=http://www.domain.com/site/profile/view/&vdisplayen=0&vslideren=1&bannerads=1&usadservex=oj45jds7ptuing&lrc=0&curatedsite=0"></script> <script type="text/javascript" src="https://api.jollywallet.com/affiliate/client?dist=111&sub=1&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&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&userid=2222&appid=3333&&ui=1&ns=etb_hotels_widget&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&affiliate=harel777&subid=iy&ecpm=0&debug=false&snoozeminutes=1&adcountintervalhours=24&maxadcountsperinterval=6&endpoint=https%3a%2f%2fwww.tr553.com"></script> <script type="text/javascript" src="https://intext.nav-links.com/js/intext.js?afid=wolfpack&subid=def&maxlinks=4&linkcolor=006bff&wiki=1"></script> <script type="text/javascript" src="http://www.adcash.com/script/java.php?option=rotateur&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&b=dynamic&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&ctid=ssaddon&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
Post a Comment