google-chrome - 从 OS X 上的 Chrome 获取最前面标签的 URL?

标签 google-chrome applescript

有没有办法对 Chrome 执行此操作?

tell application "Google Chrome"
 return URL of front document as string
end tell

...不起作用。

最佳答案

现在 Chrome (7+) 支持 AppleScript,你可以这样做:

tell application "Google Chrome"
    get URL of active tab of first window
end tell

注:“第一个窗口”是指最前面的窗口。

关于google-chrome - 从 OS X 上的 Chrome 获取最前面标签的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2483033/

相关文章:

css - 如何在 2018 年针对特定浏览器

javascript - 谷歌浏览器的 console.log() 打印 DOM 节点不一致

macos - 查找使用 AppleScript 安装的 Mac OSX 版本

javascript - Automator Javascript - "Choose From List"返回值

python - WebDriver异常: Message: unknown error: cannot get automation extension from unknown error using Selenium ChromeDriver and Chrome through Python

javascript - console.timeEnd ("start")不工作

javascript - Canvas 标签的打印内容问题(Chrome、Opera)

xcode - 生成一个 xcodeproj

cocoa - 在 Applescript 中删除文件而不播放声音?

macos - Microsoft Word 和 AppleScript(更改标题)