blocking adblocking detection javascript

10 views
Skip to first unread message

mp3geek

unread,
Jul 27, 2007, 11:47:57 PM7/27/07
to greasemon...@googlegroups.com
would be possible to block this inline javascript via greasemonkey?

<script>
function dieAdBlockPlusDie()
  {
  var giframe = document.getElementsByTagName("iframe");
  var blocked=1;
  for (var i = 0; i < giframe.length; i++)
    {
    var name = giframe[i].getAttribute("name");
    if(name == "google_ads_frame")
      {
      var blocked=0;
      }
    }
  if(blocked){window.location = 'http://articlewagon.com/thief.htm';}
  } 
setTimeout('dieAdBlockPlusDie()', 2000);
</script>

Godmar Back

unread,
Jul 28, 2007, 12:14:35 AM7/28/07
to greasemon...@googlegroups.com
Have you tried

unsafeWindow.dieAdBlockPlusDie = function () { }

?

mp3geek

unread,
Jul 28, 2007, 12:43:31 AM7/28/07
to greasemon...@googlegroups.com
Doesn't seem to work

David Aspinwall

unread,
Jul 28, 2007, 2:28:50 AM7/28/07
to greasemon...@googlegroups.com
On 7/27/07, mp3geek <mp3...@gmail.com> wrote:
> would be possible to block this inline javascript via greasemonkey?
> ...
> if(name == "google_ads_frame")

Why not just create an iframe with that name, something like:

var ifrm = document.createElement('iframe');
ifrm.name = 'google_ads_frame';
document.body.appendChild(ifrm);

RodMcguire

unread,
Jul 28, 2007, 3:03:13 AM7/28/07
to greasemonkey-users
On Jul 27, 11:47 pm, mp3geek <mp3g...@gmail.com> wrote:
> would be possible to block this inline javascript via greasemonkey?

You have not given enough information. The script is inline. If it is
called inline, e.g.

<script>dieAdBlockPlusDie()</script>

GM has no way to kill it because GM doesn't run until after the page
DOM (including its scripts) have loaded and run.


esquifit

unread,
Jul 29, 2007, 4:23:35 AM7/29/07
to greasemon...@googlegroups.com
Rod: the OP already said that the function is being called through
setTimeout (read the first message again ;-) )

I do not understand why Godmar's suggestion does not work. Anyway, it
seems you do not even need GM nor any other extension for achieving
this: Firefox already has a built-in feature called Configurable
Security Policies ("CAPS") [1] that allows blocking specific
javascript functions for specific domains. See [2] for an example.

[1] http://www.mozilla.org/projects/security/components/ConfigPolicy.html
[2] http://kb.mozillazine.org/Security_Policies#Prevent_any_JavaScript_function.2Fmember_from_being_run.2Fread.2Fset

2007/7/28, RodMcguire <mcg...@telerama.com>:

Reply all
Reply to author
Forward
0 new messages