开发者

Script Safari 5.1 to open a tab [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Open URL in new Safari tab with AppleScript

How do I tell Safari to open a URL in a new tab of the current window?

This is a duplicate 开发者_StackOverflowof Open URL in new Safari tab with AppleScript, however its answer no longer works with the current version of Safari (5.1 on 10.6.8). The tab is created but empty:

tell front window of application "Safari"
make new tab with properties {URL:"http://www.stackoverflow.com"}
end tell

If you make a new "document" instead the URL is honored, but this opens a window.

For what it's worth, I reported this as a bug to Apple. But a workaround would be great.


I don't have the latest Safari here, but this might work

tell front window of application "Safari"
    set newTab to make new tab
    set the URL of newTab to "http://www.stackoverflow.com"
    set the current tab to newTab
end tell
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜