question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Proper treatment of `about:blank` pages

See original GitHub issue

Feature Request

Is your feature request related to a problem? Please describe

When a window is created in JS with no URL it gets a window.location of about:blank:

win = window.open("", "_blank");
win.location.href // => "about:blank"

These windows are currently mistreated by darkreader in that there is no way that I see to turn it on/off for such a specific page. Even more than that, the darkreader dropdown on these pages look like something went bad somewhere: there is the top on/auto/off at the top, but clicking the buttons does nothing, and there is nothing else below them (none of the regular UI).

It makes semi-sense to just ignore such pages, since they seem to come from nowhere and it’s still good to avoid the jarring sea of bright whiteness if you happen to run into one of them, however there are valid uses of such windows, but there’s no way currently to disable darkreader for them other than turning it off globally. (See below for further context.)

Describe the solution you’d like

For such about:blank windows, it makes sense to use their window.origin to decide how to treat them. This way a blank window that was opened from https://foo.bar/ would be treated as that, so if I disable darkreader for foo.bar, it would also be disabled on about:blank windows it spawns.

Additional context

What I ran into is an issue with my home-cooked music player, which can use such windows for visualizations. (Why? Because having multiple monitors all showing changing colors in sync is a very nice thing…) My code does something like:

win = window.open("", "_blank");
win.document.body.style.background = "#fcc";

but that doesn’t work since darkreader gets in its way, and there is no way to turn it off locally. But if you look at win.origin you’ll see where it originated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Gustedcommented, Jun 29, 2021

It’s not really random – like I said, window.origin has the site that started it

Correct, and we can see that when we get a “notifcation” when a new content script has been injected into a tab.

However if we query the tab from the background-script, such information isn’t available and thus we cannot correctly handle the tab if we say “oh this tab belongs to origin x so we say in the pop-up it’s site x”, well in the background-script we cannot see such information anymore after any period of time.

if there’s an iframe with no url, then it makes sense to treat it according to its origin too

IFrames are special, such information can be recalled from querying tabs, from such that we can make sense from it. Also IFrames are in the site itself and not on a new tab and will be treated with care.

Regards, Gusted

0reactions
elibarzilaycommented, Jun 28, 2021

It’s not really random – like I said, window.origin has the site that started it, and this would only be something to use if the url is empty, which means that a new tab or an iframe would behave the same as it is now, and it’s only an empty one that would behave according to the url of whoever made it (and yes, if there’s an iframe with no url, then it makes sense to treat it according to its origin too).

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is About:Blank & How To Remove The About:Blank Pop ...
STEP 1 : Uninstall the malicious programs from Windows · Go to “Program and Features”. Right-click on the Start · Find the malicious...
Read more >
Feature request: Inserting blank pages in PDFs on the iOS app
Sometimes the margins of the paper suffice, but sometimes the details require a page or two to fully work out. Right now I...
Read more >
How to fix Google Chrome Blank page(s) problem. - wintips.org
How to resolve and fix Chrome White Screen – Chrome Blank Page – error/problem. · 1. Right-click on Google Chrome icon and choose...
Read more >
Blank Pages when accessing webpage for Manage Engine ...
1. Right-click on the blank page · 2. Click on Inspect in the context menu to open the Developer Tools · 3. Click...
Read more >
How To Stop Printer Printing Blank Pages - Printerland
There are many reasons your printer may have started printing blank pages, but this is usually an easy fix.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found