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

Can you add support for the Data URI Scheme for "Open image in new tab"? #43

Open
JoeFisherman2000 opened this issue Oct 15, 2022 · 1 comment

Comments

@JoeFisherman2000
Copy link

I really like this extension!

I see on your welcome page that the sample jpg is displayed within an img HTML element and I assume you are working off the src attribute to determine if you can display "Open image in new tab" in your context menu.

<img id="demo-img" class="pulsate-fwd shadow cursor-pointer lg:w-2/6 md:w-3/6 w-4/6 object-cover object-center rounded" alt="hero" src="cat_dog.jpg">

It would be great if you could add support for the Data URI Scheme and allow that to also display "Open image in new tab" in your context window when one is encountered.

<img id="myImage" alt="Image Display" src="data:image/png;base64,<base64EncodedString>">

Here is a sample with a tiny Base64 Encoded String included:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

Where image/png is the Media Type. Other valid image Media Types include: image/avif, image/jpeg and image/svg+xml.

Not sure if the extension currently supports PNG images but I know it supports JPG so if no other media types if you could support image/jpeg within the Data URI Schema that would really be great!

Thank you for considering this enhancement!

@Metacor
Copy link
Contributor

Metacor commented Oct 16, 2022

BetterViewer doesn't actually add any context menus, "Open image in new tab" is default browser functionality.
The way the extension works is by adding a listener to chrome.webRequest, and then checking the 'content-type' in the Response Headers to see if it is has the MIME type of "Image/*", all image types should work by default, (although /svg+xml is currently broken, the extension recognizes it but gives out errors) [examples of /avif and /png]

As for adding support for data: pages, I don't think they respond to webRequests, so it might require a rewrite of how the extension activates, I could be missing something obvious though.

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

No branches or pull requests

2 participants