title: Here is a new type of ad javascript by change "window.opener.location", how can i block it?
body: <p>One of my friend climes that his Chrome browser tab sometimes changed into "tamll.com", which was the biggest shopping website in China.</p>
  
  <p>At first I think it may be caused by a malware. But he has a clean os, and he checked everything in his computer.</p>
  
  <p>Then I found <a href="http://nv-gboy.googlecode.com/svn/trunk/navigatoral.js" rel="nofollow">this javascript</a>. The code is always in the bottom of this question. And this script is being included in "bbs.gfan.com".</p>
  
  <p>The script use window.opener.location to change another browser tab's webpage. When you open any pages in "bbs.gfan.com" from google.com(for example search "bbs.gfan.com" in google and click the first answer), this script check if the window.opener is not null, and set the window.opener.location to _5had0w.mall. Then the window.opener tab will be jumped to the new address.</p>
  
  <p>Is there any way to block a script when it try to change window.opener.location? Or is there a way to directly disable the window.opener.location?</p>
  
  <p>I think a normal webpage will never change this variable, it may only use by a ad script like this.</p>
  
  <p>This kind of ad script made me feel sick. It is not only open a ad webpage but also another webpage will gone...</p>
  
  <pre><code>if ("undefined" == typeof (_5had0w)) {
    _5had0w = [];
    _5had0w.ssite = new RegExp("(www.baidu.com)|(www.google.c)|(www.youdao.com)|(search.cn.yahoo.com)|(search.yahoo.com)|(114search.118114.cn)|(bing.118114.cn)|(search.114.vnet.cn)|(bing.com)|(www.soso.com)|(www.sogou.com)|(www.taobao.com)|(gougou.com)|(www.gouwo.com)|(cache.baidu.com)|(m.baidu.com)|(baidu.asp)|(hao123.com)|(265.com)|(114la.com)|(115.com)|(etao.com)", "i");
    _5had0w.win = window;
    try {
      if (parent &amp;&amp; parent.f &amp;&amp; parent.document.getElementById("fulliframe")) {
        _5had0w.win = parent
      }
    } catch (e) {}
    _5had0w.getcookie = function (sName) {
      var aCookie = document.cookie.split("; ");
      for (var i = 0; i &lt; aCookie.length; i++) {
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0]) return unescape(aCrumb[1])
      }
      return ""
    };
    _5had0w.setcookie = function (sValue) {
      date = new Date();
      date.setMinutes(date.getMinutes() + 100);
      document.cookie = "oc_busy=" + escape(sValue) + "; expires=" + date.toGMTString() + ";path=/"
    };
    _5had0w.mall = "http://gomallg.blogbus.com/?76";
    _5had0w.np = false;
    _5had0w.nvIt = function (lochref) {
      try {
        _5had0w.win.opener.location = lochref
      } catch (e) {
        try {
          _5had0w.win.opener.navigate(lochref)
        } catch (e2) {
          try {
            _5had0w.win.opener.opener.navigate(lochref)
          } catch (e3) {
            _5had0w.np = true
          }
        }
      }
    };
    _5had0w.nvUrl = function () {
      var _co = _5had0w.getcookie("oc_busy");
      if (_co == "" || _co.indexOf("mall") &lt; 0) {
        _5had0w.nvIt(_5had0w.mall);
        if (!_5had0w.np) {
          _5had0w.setcookie(_co + "_mall")
        }
      }
    };
    _5had0w.oload = function () {
      if (_5had0w.win.opener &amp;&amp; "" == _5had0w.getcookie('rf6_auth')) {
        if (_5had0w.ssite.test(_5had0w.win.document.referrer)) {
          _5had0w.nvUrl()
        }
      }
    };
    try {
      if (document.attachEvent) {
        window.attachEvent("onload", _5had0w.oload)
      } else {
        window.addEventListener("load", _5had0w.oload, false)
      }
    } catch (e) {}
  }
  </code></pre>