用于在 Safari 中打开 URL 的 AppleScript 导致基于 Flash 的网站崩溃 [英] AppleScript to open URL in Safari crashes for Flash-based websites

查看:36
本文介绍了用于在 Safari 中打开 URL 的 AppleScript 导致基于 Flash 的网站崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Safari 中打开一个 URL.它适用于没有嵌入 Flash 的网站,但会使 Flash 网站的 Safari 崩溃.

I'm trying to open a URL in Safari. It works fine for websites without Flash embedded, but crashes Safari for Flash sites.

示例(此作品):

tell application "Safari" to open location "http://google.com"

当 Safari 尚未运行时此崩溃:

This CRASHES when Safari is not already running:

tell application "Safari" to open location "http://grooveshark.com"

我注意到的两件事:

  • Safari 只会在嵌入 Flash 的网站上崩溃
  • 上述脚本仅在创建 Safari 的新实例时才会崩溃(即之前未运行 Safari)

根据第二个观察,我认为这可能是某种许可问题.也许从 AppleScript 启动的 Safari 实例加载插件有问题?

From the second observation I assume that it could be a permission issue of some sort. Maybe the Safari instance launched from the AppleScript has a problem loading plugins?

推荐答案

您知道打开位置"不是 Safari applescript 命令吗?因此,您不应该告诉 safari 运行该命令.打开位置"是applescript 的标准附加项,它用于在处理url 的默认应用程序中打开一个url.另外,如果 Safari 是用户的默认应用程序,并且如果 safari 尚未运行而崩溃,那么为什么不先启动 safari,然后调用您的命令......我还没有尝试过这个......它只是一个建议...

Did you know "open location" is not a Safari applescript command? As such you shouldn't tell safari to run that command. "Open location" is in the standard additions to applescript and it's used to open a url in the default application that handles the url. Plus, if Safari is the default application for a user, and if it crashes if safari isn't already running, then why not launch safari first, then call your command... I haven't tried this... it's just a suggestion...

tell application "Safari" to launch
open location "http://grooveshark.com"

顺便说一句,如果你想确保使用safari,那么你打开这个url...

By the way, if you want to make sure safari is used, then you open the url like this...

tell application "Safari"
    launch
    make new document
    tell document 1 to set URL to "http://grooveshark.com"
end tell

这篇关于用于在 Safari 中打开 URL 的 AppleScript 导致基于 Flash 的网站崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆