Perspective - Horizontal menu - Open link in new tab

Is there a way with the horizontal menu to open a link in a new tab ? Also, if there a way if link is already opened to focus on it instead to open new tab ?

1 Like

+1 To this. Why do fully realized links have to be in a new tab?

+1 to david.folkner’s comment. Can we get an option to open the link in the same tab?

Yes and no.

You can use the onItemClicked event to execute a Navigation Action and specify that the page should be opened in a new tab. This will NOT however, prevent the Horizontal menu from also performing the original navigation. This is the same avenue you would exercise to open a page in a new tab if it is already open - by using a Script action instead and checking to see if the path of the current page matches the target of the item.

	if self.page.props.path == target:
		system.perspective.navigate(page=target, newTab=True)

@david.folkner , @iceberg
Could you provide an example of a target value which is displaying the behavior you don’t want?

@cmallonee I would like to be able to have a link in the hortizontal menu to a view in a different project that I can have open in the same tab as the view that is contains the horizontal view. Thus we could navigate between projects without having a bunch of new tabs open. I would see this as essentially typing “newTab = False” in your example above.

Just like what @iceberg said. I have multiple projects on a single gateway with a shared horizontal menu. In the target field I put the whole address to a page in another project like: target: https://url.com/data/perspective/client/other_project/other_page.

I use the navigate like you mentioned, but then my tab moves AND the new tab goes there. I’ve been clever and used the navigate where I leave target empty and hard coded it elsewhere but that is unintuative to maintain.

I would like to note that in the perspective app, multiple tabs is not supported, so this isn’t an issue for my mobile users, just my desktop users. And many of them don’t know what a bookmark or a tab is, so it confuses the heck out of them.