Skip to content

Tab URLs are broken in Chrome #6444

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

Open
woky opened this issue Sep 13, 2015 · 7 comments
Open

Tab URLs are broken in Chrome #6444

woky opened this issue Sep 13, 2015 · 7 comments

Comments

@woky
Copy link

woky commented Sep 13, 2015

Tab URLs of PDF files opened with this extension in Chrome look like this:

chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://example.com/test.pdf

This is a bug for following reasons:

  • It forces the user to manually select part of the tab URL to copy the PDF URL somewhere else.
  • It breaks bookmarks of PDF URLs. The user may want to revert to default PDF viewer.

Can the URL be the actual URL of the PDF file as it is in the screenshot of the extension on Chrome Web Store?

/cc @Rob--W

@Rob--W Rob--W self-assigned this Sep 13, 2015
@Rob--W
Copy link
Member

Rob--W commented Sep 13, 2015

A few years ago, we used a different method to replace the document with HTML for the viewer. The disadvantage of this method is that it could take a few seconds in the worst case and you would briefly see a flash of gibberish (and it doesn't work for iframes either). Then I submitted a patch to Chromium so that we could get a better method to show the viewer more quickly, by intercepting the PDF request and redirecting it to the viewer (#3751).

I'm aware of the usability issue with the viewer, and I'm investigating options to resolve this. E.g. the development of a new Chrome extension API that allows extensions to modify the displayed URL (https://groups.google.com/a/chromium.org/d/msg/apps-dev/95IVTx4AiFU/gax8vKlbTD4J).

Until that feature is available, the easiest way to get a URL for the PDF is to click on the PDF.js icon in the omnibox and select the URL:

@wickles
Copy link

wickles commented Mar 9, 2016

Welp. Now the PDF icon is not even shown in the omnibox. Chromium team have lost their minds..

@GKFX
Copy link

GKFX commented Apr 11, 2018

Brief summary of #9646, which was closed as duplicate of this but takes a slightly different angle.

Using a chrome-extension:// URL prevents any other extension from modifying or accessing the page content at all. This breaks extensions such as Vimium, which rely upon being able to inject elements and event handlers into the page. Changing the displayed URL presumably wouldn't grant those third-party extensions access to the page again, so I imagine the only solution would be to go back on the approach introduced in #3751, and just start modifying the page's HTML again.

@aspiers
Copy link

aspiers commented Aug 15, 2022

This chrome-extension:// prefix really makes it more awkward to copy the URL to the clipboard, e.g. for sharing or for storing externally in a personal knowledge base. I need to do this often enough that for me unfortunately it's sufficient reason to disable the extension. But if this is not easy to fix, perhaps a workaround might be to offer an icon and keyboard shortcut for copying the original URL to the clipboard.

@Rob--W
Copy link
Member

Rob--W commented Dec 21, 2024

I'm considering to introduce an option to allow the user to choose between the current behavior (URL replaced) and the requested feature (URL preserved).

Chrome does still not have first-class support for allowing extensions to handle specific MIME types.

My implementation plan is as follows:

  • This requires the Chrome browser to include PDFium (which is the default) as the default PDF handler. The browser will then switch to a document with a PDF embed as soon as possible.
  • Convert "Content-Disposition:attachment" to inline to allow downloads to be displayed inline, as before.
  • Use content scripts to detect the PDF document, and replace the current DOM with shadow DOM where the content is rendered, in an iframe.

@edervishaj
Copy link

@Rob--W is this still planned?

@Rob--W
Copy link
Member

Rob--W commented Jun 1, 2025

@Rob--W is this still planned?

I forgot about this one. I've scheduled a reminder for myself to take another look in a month.

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

No branches or pull requests

7 participants