I would like to access the frontmost tab being displayed in Safari and retrieve the URL using the JavaScript Automation scripting in Yosemite Script Editor. I can get the first window, first tab url using code like:
Application('Safari').windows[0].tabs[0].url()
I can't figure how to find which window and tab is actually the one being displayed frontmost currently though.