Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframe with src="javascript:false;" defies filters #522

Closed
8 tasks done
jchook opened this issue Apr 11, 2019 · 11 comments
Closed
8 tasks done

iframe with src="javascript:false;" defies filters #522

jchook opened this issue Apr 11, 2019 · 11 comments
Labels
invalid not a uBlock issue

Comments

@jchook
Copy link

jchook commented Apr 11, 2019

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

A specific iframe with src="javascript:false;" will not go away!

unstoppable iframe

I have tried many combinations of filters and posted a support request on Reddit with no luck.

Examples of filters I have tried:

my.freshbooks.com##iframe
my.freshbooks.com##^iframe
my.freshbooks.com##^#zendesk-widget-iframe
my.freshbooks.com###zendesk-widget-iframe
my.freshbooks.com##.zendesk-widget-iframe
my.freshbooks.com##iframe#zendesk-widget-iframe
my.freshbooks.com##^iframe#zendesk-widget-iframe
my.freshbooks.com##iframe#zendesk-widget-iframe[src="javascript:false;"]
my.freshbooks.com##^iframe#zendesk-widget-iframe[src="javascript:false;"]
javascript:false;##iframe

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

  1. Visit Freshbooks Login
  2. Add a filter(s) for the iframe#zendesk-widget-iframe element
  3. Visit same page in a new window.
  4. See that iframe still exists in both source html and DOM.

Expected 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

  • uBlock Origin version: 1.18.16
  • Browser Name and version: Version 73.0.3683.75 (Official Build)
  • Operating System and version: Ubuntu 18.04 (64-bit)
@gorhill
Copy link
Member

gorhill commented Apr 11, 2019

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;.

@gorhill
Copy link
Member

gorhill commented Apr 11, 2019

Works as expected, see documentation regarding cosmetic filtering, known as "element hiding" in ABP: https://adblockplus.org/en/filters#elemhide.

@gorhill gorhill closed this as completed Apr 11, 2019
@gorhill gorhill added the invalid not a uBlock issue label Apr 11, 2019
@jchook
Copy link
Author

jchook commented Apr 11, 2019

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?

@jchook
Copy link
Author

jchook commented Apr 11, 2019

@gorhill Oh I see, it's only supported in Firefox?

Is there no way to remove the element in Chromium?

@gorhill
Copy link
Member

gorhill commented Apr 11, 2019

There is no way to remove elements -- see gorhill/uBlock#2252.

@uBlock-user
Copy link
Contributor

Is there no way to remove the element in Chromium?

You can use a scriptlet for element-removal.

@jchook
Copy link
Author

jchook commented Apr 12, 2019

@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);
    }

})();

@uBlock-user
Copy link
Contributor

uBlock-user commented Apr 12, 2019

@jchook no need to install TM, just use https://github.com/uBlock-user/uBO-Scriptlets/blob/master/scriptlets.txt#L45

@jchook
Copy link
Author

jchook commented Apr 12, 2019

@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".

@uBlock-user
Copy link
Contributor

uBlock-user commented Apr 12, 2019

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)

@krystian3w
Copy link

my.freshbooks.com###zendesk-widget-iframe:remove()

or

my.freshbooks.com#$?##zendesk-widget-iframe { remove: true }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid not a uBlock issue
Projects
None yet
Development

No branches or pull requests

4 participants