Chrome Extension Inject for ad blocking - google-chrome

I want to block an iframe that contains an ad in this chrome extension i'm developing. I tried using CSS and Javascript to inject code that would work, but haven't had any luck. I know there are adblockers available, but i want to remove the ad on my side for convenience. Thanks in advance.

You need to register a beforeload event handler in your content script. See documentation of this event, in short you check event.url and call event.preventDefault() if you want to block. Please note that there is currently a severe bug associated with this event: https://bugs.webkit.org/show_bug.cgi?id=45586. Just have a look at the number of bug reports this causes for the Adblock extension: http://code.google.com/p/adblockforchrome/issues/detail?id=3701 (Adblock Plus also got tons of bug reports, these aren't as centralized however).

Related

Popup blocker handling when app calls displayReplyAllForm method

Would you please help me to resolve "Blocked Pop-up Window" problem ?
When I submit our app to AppSource, we get following failure message from partner center.
Customer Control 1100.5.4.2 Blocked Pop-Up Window
Pop-up windows triggered by user interaction must not be blocked by browser pop-up blockers on their default settings. A pop-up blocked appears in the browsers when we click on the "insert" button within your add-in. Please update the offer to correct pop-up window behavior and re-submit your offer.
This is happened when our app calls displayReplyAllForm by user interaction. How can I resolve this problem technically ?
Because of following investigation, IMO, Office team should handle this problem.
In general, I should call window.open directly from user-interaction for avoiding popup blocker.
For detecting and handle popup blocker, I can utilize returned value from window.open.
But, I can't do this because window.open or something popup logic is wrapped in displayReplyAllForm. So, I think it should be handled by Office team.
My suggestion is that Office team provide promptBeforeOpen option for displayReplyAllForm. I can avoid popup blocker with promptBeforeOpen when I use Dialog API, and want to use it in other functions provided by Office.js.
Microsoft product team has repro the issue and has added this to their backlog. Let's wait they'll fix the problem and we can avoid bad UX in the future.
https://github.com/OfficeDev/office-js/issues/1377#issuecomment-690049886

Using DOMFormHasPassword and DOMInputPasswordAdded events in chrome extensions

tl;dr:
I'm trying to figure out how to use the DOMFormHasPassword and DOMInputPasswordAdded events in chrome extensions.
I'm trying to develop a password manager extension in chrome for my
school project. To make it, I would need a way to identify a login form and fill it automatically. So far I had relative success, but I encountered a problem: I would scan the page for a login form on page load, so if any form were to be added through javascript my extension would miss it.
I have googled the matter and found the terms DOMFormHasPassword and DOMInputPasswordAdded in some locations online, such as this one that states that the DOMFormHasPassword event was added to chrome, and some sort of an example of its use that I couldn't understand.
I've tried adding the events with document.addEventListener, without any success.
I also encountered the term SpecialPowers that I don't understand, and I think understanding it might solve my problem.
I Would be very grateful if you could even direct me to a documentation of those events, because I can't seem to to find it. Thank you for your time!

Make visitors adblock filter block non-ad elements

I have a Bitcoin faucet which is funded through ads. I would not like users to be able to claim if they have adblock enabled. Is it possible to attach something to a button to make adblock see it as an ad and block it, thereby stopping the user from claiming?
I would prefer it to be in HTML.
You just need to make the button "look" like an ad to AdBlock. For example, give it an id like MainAd; most installations of AdBlock use a list that will block this. Many users use the EasyList rule set, which has many examples of rules that will trigger the blocker.
Demo (only works if you have AdBlock installed, of course).

Trigger.io: Anyway to pre-load the HTML for the forge.tabs.openWithOptions()

We are displaying our Ads using forge.tabs.openWithOptions, but the problem is the user can quickly close the tabs even if the content inside the tabs not yet finished loading. So the whole Ad System became not usable and we can't be able to earn to it.
Is it possible to pre-load the html url even though the tabs was not yet shown? Or can we disable the close button for a certain amount of time to force the user to view the ads?
Waiting for your response, thanks!
As you stated in the comments, caching will not do the trick as the ads content changes everytime. Having said this, your best bet would be to somehow disable the close button of forge.tabs. This is most probably only possible by implementing your own custom forge.tabs using native modules.

How can I assign shortcuts that activate the different installed Chrome Extensions?

I have a few extensions (with their icons up on the right). I'd like to assign a shortcut for activating each one of them, i.e. a shortcut that simulates clicking the mouse on them.
One extension e.g. is a dictionary and it would be more than useful to be able to open it without tinkering with the mouse.
There's a way to do this in chrome://extensions if you go to the bottom of the page and find "Configure commands" link.
I also am wondering about how to do this, and here is the possible solution suggested by Misha Kupriyanov:
https://plus.google.com/u/0/108214193841489989707/posts/2YBaEqRsCPw
You can take the Quick Disable Chrome extension by +Paul Kinlan (you can find the source on github)
It uses the chrome.management API http://code.google.com/chrome/extensions/management.html
and now you can write your own pageAction extension ;) = include on each page your JavaScript for catching keyboard events and triggering enable/disable events via chrome.management API
Also check out the Vimium (also open source) by Ilya Sukhar (i am not sure its his account)
Try Autohot, it's a free tool that makes it easy to automate that kind of things, easiest would be:
wait for your "keyboard shortcut" to be fired
check that google chrome is the active window
click on the fixed mouse coordinate to activate the extension