[Feature-11590] System.perspective.navigate() Lacks Option To Open New Tab

Hi,

Is there a way to use the function system.perspective.navigate() to open a view in a new tab?
documentation does not show the parameter to do this
we try to search it in the JSON code of a view with a button event/onClick/Navigation

and obtain code below

Blockquote
{
"events": {
"dom": {
"onClick": {
"config": {
"newTab": true,
"url": "http://..."
},
"scope": "C",
"type": "nav"
}
}
}

We can see the parameter newTab in the code, so we try

system.perspective.navigate(url='http://...', newTab = true) and system.perspective.navigate(url='http://...', newTab = "true")

but the view open in the same tab
.
here is the code that we obtain in the JSON then

Blockquote
{
"events": {
"dom": {
"onClick": {
"config": {
"script": "\t\n\tsystem.perspective.navigate(url\u003d\u0027http://...\u0027, newTab \u003d "true")"
},
"scope": "G",
"type": "script"
}
}
}

we can also see that the scope is not the same.

Does the system.perspective.navigate() function allow to open a view in a new tab? Or Is there another way to do this?

Thanks

Pierre

2 Likes

The system.perspective.navigate() function does not allow for opening another tab at this time. There is an open feature request already logged to provide this functionality, but no indication of when that ticket is expected to be acted upon.

I believe you are able to do this with the Link component, if that is an option. This would require that the navigation be moved out of an Action and that the Link component be configured to use a target of _blank.

Thanks for your prompt,

we had actually assumed that link component would be the solution for now

Thank again.

Pierre

Any updates on this? I need to trigger an "open in new tab" off messageHandler and unfortunately realizing its not really possible yet

1 Like

That issue has had no movement. I’ll update the issue to show another request.

3 Likes

I’ve been able to workaround by using a view custom prop that is either bound or updated by a script event. I’ve also added a script action ahead of a navigation action - using the script to update the custom url prop and then binding the url property in the navigation event with the “open in new tab” box checked.

This approach covers every scenario with the exception of logic where you would want to abort the navigation action based on conditions in the script action.

It would be a big improvement if the newTab keyword were added to the system.perspective.navigate() function.

1 Like

The existing feature requests recommends the introduction of a couple of optional kwargs which would be used to determine whether the navigation should occur in the same tab (default if no optional kwargs are supplied), in a new tab, or in a new window.

2 Likes

Unfortunately mine has to come from a messageHandler, so I did this by having an embedded view that doesn’t display, and setting the embeddedViewPath and URL parameter from within my messageHandler. That way it triggers the onStartup event for the embeddedView and I can run the action with “open in new tab” selected.

I played a lot with how to use a script to trigger an “action” on another component, and was struggling to find one, most of them seem to be geared towards the user doing something.

I am looking forward to the updated system.perspective.navigate to say the least! lol

Any movement on adding this functionality to the function?

Opening in a new tab was added in 8.1.5.
https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate

Opening in a new window was found to be too inconsistent across our supported browser matrix, so not offered as an option at this time.

2 Likes