Mar*_*son 8 macos firefox applescript google-chrome
如何告诉Chrome或Firefox在顶部窗口重新加载文档?这是我用于Safari的内容:
osascript -e '
tell application "Safari"
activate
do JavaScript "history.go(0)" in document 1
end tell
'
Run Code Online (Sandbox Code Playgroud)
Ben*_*jie 39
以下是Chrome的代码:
tell application "Google Chrome"
tell the active tab of its first window
reload
end tell
end tell
Run Code Online (Sandbox Code Playgroud)
或者更简洁:
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
Run Code Online (Sandbox Code Playgroud)
我不认为Firefox或Chrome有特殊的Applescript支持,但您可以发送击键(Cmd-R)来刷新页面:
tell application "Firefox"
activate
tell application "System Events" to keystroke "r" using command down
end tell
Run Code Online (Sandbox Code Playgroud)
这是在不使用JavaScript的情况下在Safari中执行此操作的另一种方法:
tell application "Safari"
tell its first document
set its URL to (get its URL)
end tell
end tell
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3740 次 |
| 最近记录: |