Skip to content
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

window.open does not load inject_js_start or inject_js_end when opening the page. #7320

Closed
kevinkenken opened this issue Jan 16, 2020 · 9 comments
Assignees
Labels

Comments

@kevinkenken
Copy link

NWJS Version :0.43.5
Operating System :window

Expected behavior

window.open loads inject_js_star or inject_js_end when opening the page.

Actual behavior

window.open does not load inject_js_star or inject_js_end when opening the page, the new window "position": "center" does not work and sometimes cannot be closed.

How to reproduce

using nw2

@rogerwang
Copy link
Member

Could you please provide a full sample (not code snippets) so we can reproduce?

@kevinkenken
Copy link
Author

package.nw.zip

@rogerwang
Copy link
Member

You can try to pass inject_js_start and inject_js_end as parameter of nw.Window.open. See an example here: https://github.com/nwjs/nw.js/blob/nw44/test/sanity/issue4286-inject-start-end/index.html

@rogerwang
Copy link
Member

btw, I also tried the scenario that the 2 options are in package.json and they are applied to nw.Window.open correctly: https://github.com/nwjs/nw.js/tree/nw44/test/sanity/manifest-default-inject

@kevinkenken
Copy link
Author

kevinkenken commented Jan 17, 2020

I know that nw.Window.open works like this; the content of the target page cannot be changed in my project, it is more like a custom browser, so I need to click the link orwindow.open() To use 2 options in package.json, this option is valid in nw1 and not valid in nw2. You can see the difference in --disable-features = nw2 in the source code I provided.

@rogerwang rogerwang self-assigned this Jan 17, 2020
@rogerwang rogerwang added the nw2 label Jan 17, 2020
@rogerwang rogerwang changed the title window.open does not load inject_js_star or inject_js_end when opening the page. window.open does not load inject_js_start or inject_js_end when opening the page. Jan 17, 2020
@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

rogerwang added a commit that referenced this issue Jan 17, 2020
@kevinkenken
Copy link
Author

After the ‘nightly build’ test, the above 2 options were resolved. However,position was not inherited, and nw1 was inherited.

@rogerwang
Copy link
Member

The position field in manifest should not be inherited as described by the document: http://docs.nwjs.io/en/latest/References/Manifest%20Format/#window-subfields

@rogerwang
Copy link
Member

In NW1, the position field is not inherited either. It's just that the default position is centered in NW1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants