Jump to content

Open a URL - Newbie Help


Recommended Posts

25 minutes ago, aputty said:

hoping that the solution would work for all browsers

 

No way, José. You can tell any application to open something in a universal way, as that's simply how macOS talks to applications.


As soon as you want to dictate how an application should open something, you're talking about application-specific APIs. I mean, there can't be a universal way to say "open this in the active tab" when many applications don't even have tabs.


To answer your question, this script will open the given URL in the active Chrome tab. Put it in a Run Script action with Language = /usr/bin/osascript (AS) and with input as argv.

 

on run argv

    tell application "Google Chrome" to set URL of active tab of front window to (first item of argv)

end run

 

Be aware, this is an extraordinarily rudimentary script. If there's no Chrome window to open the URL in, it will fail. I'll leave fixing that case up to you :) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...