Jump to content
aputty

Open a URL - Newbie Help

Recommended Posts

Hi,

 

I am able to use the workflows to open a URL. However, I want to be able to open a URL in the same tab that is currently being viewed/loaded. how do I achieve this?

 

Thanks.

 

Avi

Share this post


Link to post
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 :) 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...