I created a macro to check the address of a link and do various things depending on the address. If the link doesn’t meet the conditions, I will like safari to simply open a new tab in the background.
How do I make the new safari tab open in the background and not the foreground?
Hey Mirizzi,
By link do you mean the URL of the front page in Safari?
A link would refer to a link to a URL (URI) within the page itself.
Try this and see if it does what you want.
set myURL to "https://www.google.com"
tell application "Safari"
tell front window
make new tab at end of tabs with properties {URL:myURL}
end tell
end tell
You have to resort to AppleScript to do this anyway, so for economy I’d do everything in AppleScript.
set myURL to "https://www.bing.com"
tell application "Safari"
tell front window
if (URL of current tab) starts with "https://www.google.com" then
make new tab at end of tabs with properties {URL:myURL}
end if
end tell
end tell
-Chris
Simple and works perfectly. Thanks.