如何告诉Chrome或Firefox在顶部窗口中重新加载文档?下面是我使用的是什么样的Safari浏览器:Mac:在Chrome或Firefox中重新加载文档?
osascript -e '
tell application "Safari"
activate
do JavaScript "history.go(0)" in document 1
end tell
'
如何告诉Chrome或Firefox在顶部窗口中重新加载文档?下面是我使用的是什么样的Safari浏览器:Mac:在Chrome或Firefox中重新加载文档?
osascript -e '
tell application "Safari"
activate
do JavaScript "history.go(0)" in document 1
end tell
'
我不认为Firefox或Chrome有特殊AppleScript的支持,但你可以发送击键按(Cmd-R)刷新页面:
tell application "Firefox"
activate
tell application "System Events" to keystroke "r" using command down
end tell
这里的另一种方式做到这一点在Safari中没有使用JavaScript:
tell application "Safari"
tell its first document
set its URL to (get its URL)
end tell
end tell
下面是Chrome的代码:
tell application "Google Chrome"
tell the active tab of its first window
reload
end tell
end tell
或者更简洁:
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
Firefox应该可以了,但显然已经被当前的3.5.x版本打破了。 – 2010-01-19 05:31:34
漂亮!这适用于所有三种浏览器,使用“Firefox”,“Google Chrome”和“Safari”作为应用程序字符串。 – 2010-01-19 06:19:46