How can I find the folder for chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai (the hidden "Chrome PDF viewer")?
I need to access these files and change its JavaScript to send me a message before printing a PDF.
How can I find the folder for chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai (the hidden "Chrome PDF viewer")?
I need to access these files and change its JavaScript to send me a message before printing a PDF.
Share Improve this question edited Dec 20, 2018 at 14:44 Xan 77.5k18 gold badges197 silver badges217 bronze badges asked Dec 20, 2018 at 10:00 HTardaHTarda 1011 gold badge1 silver badge6 bronze badges1 Answer
Reset to default 12It's an internal ponent of Chrome; it's not really a physical folder to navigate to, this is piled into the Chrome's own files (specifically resources.pak
- thanks, wOxxOm).
You can get the source code of that extension from the Chromium source, e.g. https://chromium.googlesource./chromium/src.git/+/71.0.3578.98/chrome/browser/resources/pdf - note that those still need pilation with the Closure Compiler, so not usable for modification as-is.
But suppose you do modify and pile it. Can you install your modified version? Yes and no.
While it is technically possible to override the extension by presenting an unpacked extension with a higher version
and the same key
in the manifest..
..it will not actually work like that, because the manifest uses elevated "private" permissions..
"permissions": [
"chrome://resources/",
"contentSettings",
"metricsPrivate",
"resourcesPrivate"
],
"content_security_policy": "script-src 'self' blob: filesystem: chrome://resources; object-src * blob: externalfile: file: filesystem: data:; plugin-types application/x-google-chrome-pdf",
..that can't be used from a non-internal extension:
So if you really wanted to modify the internal PDF viewer, you'd need to pile your own modified version of Chromium, or at the very least your own version of resources.pak
. Probably not what you want to do.