Closed MagicalDrizzle closed 2 months ago
@MagicalDrizzle Interesting. First of all, can you tell me your use case? Because if you just paste the URL directly in the address bar and press enter, it would open in doqment if it's a PDF (I'm assuming you are on Firefox).
doqment already does cross-origin all the time. I just pass the URL of the PDF to the PDF.js viewer. Then, the PDF.js script hosted on the extension's origin (which is https://<extension-id>/
) loads the PDF located on any random origin. Apparently, extensions are allowed to do this, because I don't do anything particular to make this happen.
Technically, I haven't forked PDF.js; I just take their public build and make a few changes needed.
I'm actually on Chromium-based in Android, which sadly does not have a embedded PDF viewer (so when you click a pdf it just downloads) and I'm trying to work around that with pdf.js (get a pdf link and load it in browser) Actually I'm not sure why I asked this here, Brave Android doesn't actually support extensions haha...
Yes, that's sad unfortunately. But the time when Google will allow extensions for Chromium on Android is quite far..
If you must, Firefox for Android does support extensions, and doqment works more or less well on it. But that's not actually a "solution"..
Like you would open the extension's new tab and would be able to insert an external PDF's URL into a text field option to load it, for example. Apparently it's not easy to do it in vanilla pdf.js because of cross origin security stuffs - and public builds of pdf.js simply doesn't allow it. I looked further and found a couple of interesting links: A self-hostable proxy to use CORS to bypass the restriction, and the source repo.
I'm curious since you have forked pdf.js, that if this feature request is now possible.