How does my app get access to the current window's URL if it is a browser?

Assume I have screen recording and accessibility permissions for my native macOS application!

I am trying to create a tool that allows people to go back in time to previous websites they have been on!

Replies

Your best option here, at least for Safari, is Apple events. For example, this AppleScript returns the URL of the active tab:

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

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"