ObsidianCustomFrames
ObsidianCustomFrames copied to clipboard
Some sites cause a crash when moved to a new window
after open google scholar website(https://scholar.google.com/) in the note panel, if i Turn it into a separate window with a command “move to new window” the obsidian will Automatic shutdown
@Ellpeck: The view may need an onWindowMigrated() handler to recreate itself when moved to a new window. I've noticed that moving my own custom frame to a new window causes it to stop accepting clicks in the view area. It still accepts the Obsidian commands for navigation etc. but can't click or scroll.
@Xieleilab: Does the issue happen with an iframe, or only with webview? Try configuring the frame to "Force iframe", then restart Obsidian and try again.
I ran into this with Notion, I selected the Notion template but had to switch to iframe - moving to a new window was crashing Obsidian. With the forced iframe though, it seems it can't set the login cookie/token, and the auth page just cycles. I have ClickUp in another frame webview and it doesn't crash on moving that one to a new window.
Let me know if I can provide any logs or other details since it seems similar to the original report!
Hmm, recreating the webview in the onWindowMigrated
event doesn't seem to fix this issue for the Google Scholar site, @pjeby.
I'm not sure what's causing this issue, and it's hard to debug without a proper way to see the crash information (and Obsidian doesn't supply a default log file or location by default).
It sounds like an Electron issue, likely that the webview wasn't implemented with window switching in mind. I've previously suggested to the Obsidian devs that they add a pre-migration event of some sort, but from what they say it's rather difficult. I'll have to give it some thought and see if I can come up with a way to detect it anyway. If so, then the webview could be detached before the DOM moves to a new window, and that might then prevent the crash. (Since detaching a webview and not moving it to a new window doesn't seem to be a problem.)
Update: @lishid has reached out to me with a fix he found for this issue, and I'll be implementing it shortly! 🎉