applescript

AppleScript Browser Interactions

Introduction#

AppleScript is able to retrieve the URL of the current tab of a browser.

Returning tab URLs

Safari

To return the URL of the current tab in Safari, use URL of current tab:

tell application "Safari"
    return URL of current tab of window 1
end tell

Google Chrome

To return the URL of the current tab in Google Chrome, use URL of active tab:

tell application "Google Chrome"
    return URL of active tab of window 1
end tell

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow