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
[Bug]: Cannot embed PDF in iframe when accessing local files via protocol.registerFileProtocol(). #33094
Comments
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump |
Update: I'm still finding (in Electron 21.2.0) that loading a PDF in an iFrame fails to display the PDF, and loading a PDF in a webview crashes Electron. Here's an Electron Fiddle gist that demonstrates this: https://gist.github.com/george-thomas-hill/c3179e6eddeb1a2715201a20dbf95015 |
I'm seeing the same issues with no workaround. Using Electron 21.3.0 iframe, embed, object => grey box - network tab shows file was requested correctly I get this error in the console: [70442:1118/152356.989338:ERROR:bad_message.cc(29)] Terminating renderer for bad IPC message, reason 1 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue. |
+1; I have the same problem in 24.1.3 |
Same problem with electron 26... |
Preflight Checklist
Electron Version
17.1.0
What operating system are you using?
Other Linux
Operating System Version
Kubuntu 21.04
What arch are you using?
x64
Last Known Working Electron version
n/a
Expected Behavior
I expect to be able to display a PDF (or any other arbitrary local file) by embedding it in an iframe inside a BrowserWindow instance.
I expect to be able to access the local file by using protocol.registerFileProtocol() as described here: #23393
Actual Behavior
When I use the minimal test case available here . . .
https://github.com/george-thomas-hill/demo-electron-problem-embeding-pdf
. . . the PDF does not display.
My renderer process displays an empty iframe.
In my console, I get the message:
Testcase Gist URL
No response
Additional Information
This might be related to the following issue: #28407
However, that issue's given workaround isn't available to me, because I'm using electron-forge and webpack, so my main process needs to have
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY)
; I don't see a way to useloadURL('app://./index.html');
.I am able to display arbitrary files by using the following in app.jsx:
However, the Electron documentation advises against using
<webview>
elements, i.e. here: https://www.electronjs.org/docs/latest/api/webview-tagI have also tried using the following in app.jsx:
However, that crashes my app.
I believe that this constitutes a bug, and I hope it can be fixed.
Alternatively, I would be grateful for any advice regarding how to securely use
<webview>
tags (or some other work-around).Thank you.
The text was updated successfully, but these errors were encountered: