roadmap
roadmap copied to clipboard
Targeting New Window
Hello,
Is there a way to target a window that you have created with Neutralino with a link from another window? I am hoping to be able to do something where clicking a link in the main window will open a URL in the second window, like this:
onclick="window.open('/url', 'mywin');"
Thanks!
Hello.. Thanks for reporting this issue. Could you please check whether you can fulfill your requirement with window.create
?
Thanks :tada:
It seems that window.create allows me to create a window and open a URL just fine, but it seems that I can't target that window via a simple link or with window.create after that. Here is what I experience.
<!-- First link opens a new window -->
<a href="#" onclick="Neutralino.window.create('/link1.html', {
title: 'Window 2',
exitProcessOnClose: true,
processArgs: '--window-name=myWindow',
});">Link 1</a>
<!-- Second link opens a new window, rather than opening in the window named myWindow if it exists -->
<a href="#" onclick="Neutralino.window.create('/link2.html', {
title: 'Window 2',
exitProcessOnClose: true,
processArgs: '--window-name=myWindow',
});">Link2</a>
<!-- Third link doesn't open -->
<a href="/link3.html" target="myWin">Link 3</a>
With the JS function on a basic webpage I would experience the following:
<!-- First link will create new window named myWin and open the link -->
<a href="#" onclick="window.open('/link1.html', 'myWin');">Link 1</a>
<!-- Second link will do the same, but if myWin already exists, the link will open in the existing window. -->
<a href="#" onclick="window.open('/link2.html', 'myWin');">Link 2</a>
<!-- Third link will open in myWin if it exists or open in a new window called myWin -->
<a href="link3.html" target="myWin">Link 3</a>
Not sure if Neutralino.window.create is intended to allow for this kind of targeting, but it would be convenient in the simple app that I am creating.
Thanks for your guidance!