0

There is a website that already exists and it has an ad that disappears after a countdown via JavaScript the runs a function to remove the ad.

I know what the function is and everything and I am trying to make a program for myself and friends to use to bypass this ad.

After some research it looks like using a chrome extension is the best way.

I currently have

{
"name":"Ad skip",
"description":"ad skip",
"version":"1",
"manifest_version":2,
"content_scripts": [
    {
      "matches": ["http://www.webiste.com/*","https://www.website.com/*"],
      "js": ["myscript.js"]
    }
  ]
}

as my manifest file, an I'm pretty sure what I need is the content script to have the code that calls that function.

The name of the function in this case we'll call hide_ad();

Preferably I would like a way to make this inject an onload="hide_ad()" into somewhere.

I've already tested moving the function call to other places in the code by using "inspect element" and self injecting an onclick="hide_ad()" onto a <div> with a random image that was already on the page and it worked

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Nick
  • 179
  • 4
  • 13
  • 1
    You haven't really posed a question. But... your injected JavaScript cannot interact with the JavaScript on the page - they run in separate sandboxes. So if `hide_ad()` is an existing function on the page, you will not be able to call it. However, you can still do whatever it was doing to the DOM, i.e. hide or remove html elements. – Steve Campbell Dec 23 '15 at 23:29
  • @SteveCampbell has the right answer. Also, you have a spelling mistake in your "matches", just a heads up. – raduation Dec 24 '15 at 01:35
  • Well, I think that you can (the fact is that there are some chrome extensions that can interact with other javascripts. You can `inject` your own script and with it you can try to make interact with the website's script. See this question: http://stackoverflow.com/questions/9515704/building-a-chrome-extension-inject-code-in-a-page-using-a-content-script – Mosh Feu Dec 24 '15 at 06:01

0 Answers0