LulumiProject / lulumi-browser

Lulumi-browser is a lightweight browser coded with Vue.js 2 and Electron.
Apache License 2.0
437 stars 90 forks source link

window.opener is not fully supported by Electron #38

Open xzycn opened 6 years ago

xzycn commented 6 years ago

Hi, do you have meet this problem? Just as MarshallOfSound said:

window.opener support doesn't quite work in Electron primarily due to our process model, this may change at some point in the future.

The underlying issue confused me very much :(

xzycn commented 6 years ago

I have tested with lumi-browser in some situations,trouble with the same issue. :( :(

qazbnm456 commented 6 years ago

Yes, I've been suffering the pain of window.opener related bugs for a really long time. Hope they will fix the issue soon. 😞

xzycn commented 6 years ago

@qazbnm456 I have to stop my project that has cast my a lot time, it's a disaster :( Maybe we can try nwjs?But,almost all things we have done before need to be redone.

qazbnm456 commented 6 years ago

For some personal preferences, I'll still stick to Electron instead of NW.js actually. Maybe you can give it a try, but lots of things indeed need to be reimplemented. 😕

xzycn commented 6 years ago

@qazbnm456 Hi, Electron 2.0.0 has been released yesterday :), but the issue still :( Do you find a way out now?

qazbnm456 commented 6 years ago

Nop, I think the issues will only be resolved when the upstream lands patches or something. However, the progress is slow and priority is not that high currently. 😭

By the way, do you have a minimal repro that can directly test this issue? Maybe I can try to figure out some workarounds in months.

xzycn commented 6 years ago

@qazbnm456 Hi, sorry for my delaying reply.I created a gist for a minimal repro, you could check it in your free time :) Note: You should check the window.opener in console within new window.

qazbnm456 commented 6 years ago

@xzycn Thanks! I'll notify you once I get some time and make some progress.

xzycn commented 6 years ago

@qazbnm456 Hi, I have made some changes that make it more reasonable in the gist. However, there is a weird thing: the param webPreferences .nativeWindowOpen is noneffective when mainWindow initial.But putting it in inline of webview tag is effective.like this: <webview src="wv.html" webpreferences="nativeWindowOpen=yes" allowpopups></webview>

qazbnm456 commented 6 years ago

Thanks for the heads up. I think the rationale of the problem you mentioned is that you try to load the vw.html file within a WebView, but it doesn't inherit the nativeWindowOpen option from the parent BrowserWindow. Therefore, setting the option directly onto the webview tag is needed.

xzycn commented 6 years ago

@qazbnm456 do you have met the problem that downloading a truncated file like a csv file with a 4kb size?:(

qazbnm456 commented 6 years ago

@xzycn Is that another problem? Could you please open another issue that addresses and describes the details of the problem? Thanks!

xzycn commented 6 years ago

@qazbnm456 sorry for my hehavior, it actually is a problem i met in my project not in lulumi ORZ.

xzycn commented 6 years ago

@qazbnm456 Hi,my friend.I got a solution, it's a fork of electron ,maybe you could try,it has a feature:

scriptable window.opener support

:) enjoy.