Open link in browser via scripting

I did the navigation the other way:
I don’t use Vision Menu Tree. Now I use Perspective Menu Tree, so now it works without any Gateway scripts.

But now I have the other problem: I cant open url in new tab via script system.perspective.navigate(url=‘link’)…
I searched for the information about it on the forum and I found that it’s impossible :rofl:

I need to open new link in new window, because IFrame can’t show me GoogleMap :woozy_face:

I am lost… :pleading_face:

I think you might be looking for the webbrowser jython module that should be included in Ignition’s install.

import webbrowser
1 Like

But it does not open(

Error running action ‘component.onItemClicked’ on MAP_Vision (1)@C/root/Content/MENU/MenuTree: Traceback (most recent call last): File “function:runAction”, line 39, in runAction File “C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\”, line 26, in open_new return, 1) File “C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\”, line 23, in open raise Error(e) webbrowser.Error: Failed to open,24.994132. Error message: An error occurred in sending the command to the application.

Without knowing the specifics of your system, I think it might have something to do with this.

You can use the webbrowser module to open your preferred browser and then open the URL after.


import webbrowser

url = ''

# MacOS
chrome_path = 'open -a /Applications/Google\ %s'

# Windows
# chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'

# Linux
# chrome_path = '/usr/bin/google-chrome %s'

1 Like

Another option:

from com.inductiveautomation.ignition.client.util import BrowserLauncher

Another option, depending on your platform, is system.util.execute - Windows has a start executable that will open a link with the associated default program, and on most Linux desktops you could use xdgopen.


thanx guys! :boom:
but nothing’s working for me… Unfortunately…

actually it’s strange why system.perspective.navigate doesn’t have the function NewTab…
I think it’s very important to have this!
Hope the function will be presented in the future…

All the examples given were examples for Vision, not perspective. Perspective scripts run on the gateway, so you can’t launch other applications there.

In HTML, it would be as simple as adding a target to a link, but I don’t know perspective well enough to know how you should achieve this in perspective.

1 Like

@Sanderd17 ‘s response made me take a step back and re-read the original post. I apologize for potentially leading you down the wrong path.

If you are using the Perspective Menu Tree, there is a “target” property in each of your items. You may place an external url there and it should open in a new tab

Otherwise, you might look into placing the Link Component on a page for navigation.

I would be interested in knowing whether this solves your problem or if you still need some way to do this via scripting.

Hope this helps!

1 Like

the easiest solution I have ever met :smile:
Thanx so much!! It works of course! :ok_hand: :handshake:


Can You give me one advise about how to check if I pressed “BACK” in menu tree?
I thought I can get a path for that with value “0”, but it gives no path if I press “BACK”…
so… how to know if I pressed back?

I solved my issue!)
No need for help anymore! Thanx everyone who tried to help me! :boom:

1 Like