Closed jchook closed 5 years ago
See that iframe still exists in both source html and DOM.
As expected. Cosmetic filters do not remove elements from the DOM, they are simply hidden using a CSS style display: none !important;
.
Works as expected, see documentation regarding cosmetic filtering, known as "element hiding" in ABP: https://adblockplus.org/en/filters#elemhide.
I have attempted HTML filters, e.g.:
my.freshbooks.com##^#zendesk-widget-iframe
Quoting from the documentation:
These HTML filters will cause the elements matching the selectors to be removed from the streamed response data, such that the browser will never know of their existence once it parses the modified response data. This makes it a powerful tool in uBO's arsenal.
Did I use the html filter syntax incorrectly?
@gorhill Oh I see, it's only supported in Firefox?
Is there no way to remove the element in Chromium?
There is no way to remove elements -- see https://github.com/gorhill/uBlock/issues/2252.
Is there no way to remove the element in Chromium?
You can use a scriptlet for element-removal.
@uBlock-user Thanks for the suggestion. I started looking into that but ended up using TamperMonkey to solve the problem:
// ==UserScript==
// @name Remove ZenDesk iframe
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Solves a problem with 1Password + Freshbooks
// @author You
// @match https://my.freshbooks.com/
// @grant none
// ==/UserScript==
(function() {
'use strict';
var iframe = document.querySelector('#zendesk-widget-iframe');
if (iframe) {
iframe.parentNode.removeChild(iframe);
}
})();
@jchook no need to install TM, just use https://github.com/uBlock-user/uBO-Scriptlets/blob/master/scriptlets.txt#L45
@uBlock-user kind of difficult to figure out how to apply this.
With TM, it's "Just Javascript", takes 5 seconds, and boom it works first try.
With uBlock, I get half-examples for an obscure DSL, I get your link to a .txt file containing several javascript chunks in a different repository... I have to read code to even understand how to pass arguments to scriplets.
Then the docs state:
Keep in mind the resource library is completely under control of the uBO project, hence only javascript code vouched by uBO can be inserted into web pages, through the use of a valid resource token.
Yet eremove.js
doesn't appear in the controlled list of resources, and I don't see any mention of loading from uBlock-user repository unless I do a lot of "required reading" and eventually load some file into an advanced setting that "probably will behave in ways unexpected to you".
kind of difficult to figure out how to apply this.
@jchook https://github.com/uBlock-user/uBO-Scriptlets#installation (Only to be done once)
Add filter in My Filters --
my.freshbooks.com##+js(eremove.js, #zendesk-widget-iframe)
my.freshbooks.com###zendesk-widget-iframe:remove()
or
my.freshbooks.com#$?##zendesk-widget-iframe { remove: true }
Prerequisites
Description
A specific iframe with
src="javascript:false;"
will not go away!I have tried many combinations of filters and posted a support request on Reddit with no luck.
Examples of filters I have tried:
The log appears to claim that uBO blocks the iframe.
I also tried enabling "Block 3rd party frames" with no success.
A specific URL where the issue occurs
https://my.freshbooks.com/#/login
Steps to Reproduce
iframe#zendesk-widget-iframe
elementExpected behavior:
I expect uBlockOrigin to remove the iframe from the HTML and from the DOM via various filters.
Actual behavior:
The iframe remains in both the HTML and the DOM.
Your environment