直接链接到 SWF,有什么缺点? [英] Linking directly to a SWF, what are the downsides?

查看:24
本文介绍了直接链接到 SWF,有什么缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常使用 objectembed 标签的组合或更常用的 JavaScript 将 Flash 和 Flex 应用程序嵌入到 HTML 中.但是,如果您直接链接到一个 SWF 文件,它将在浏览器窗口中打开,如果不查看地址栏,您就无法判断它没有嵌入到 HTML 中,并且大小设置为 100% 宽度和高度.

考虑到将 Flash 或 Flex 应用程序嵌入 100% 的浏览器窗口所需的 HTML、CSS 和 JavaScript 的开销,直接链接到 SWF 文件的缺点是什么?有什么好处?

我能想到一个好处和三个坏处:您不需要 100 多行 HTML、JavaScript 和 CSS,否则您需要进行其他操作,但是您没有插件检测、没有版本检查,并且您失去了最佳的 SEO 选项(渐进增强).

更新不要被 100 多行代码所困扰,我只是说嵌入 SWF 所需的代码量相当多(我的意思是包括像 SWFObject 这样的库), 只是为了显示 SWF,直接链接就可以不用一行了.

解决方案

直接链接到 SWF 文件的好处:

  • 更快的访问
  • 您甚至在点击链接之前就知道这是一部 Flash 电影
  • 跳过 html &js 文件(无论如何你不会使用 CSS 来显示 100% 的 Flash 电影)

缺点:

  • 您几乎无法控制电影默认设置.
  • 您不能使用自定义背景颜色、透明度等.
  • 您不能使用 flashVars 从 HTML 向电影发送数据
  • 无法使用 fscommand 从电影到页面
  • 电影比例永远不会与用户窗口的纵横比相同
  • 您无法弥补浏览器的不竞争力(下一个新浏览器问世,您遇到了麻烦)
  • 没有搜索引擎优化
  • 没有页面标题,如果您希望人们正确添加书签就不好.
  • 没有插件信息、下载链接等
  • 如果您的 SWF 连接到外部数据源,您可能会遇到跨域问题.
  • 重命名 SWF 文件也会重命名链接.不利于版本控制.

简而言之,对于复杂的应用程序 - 始终使用 HTML.对于简单的动画电影,您可以选择任何一种方式.

Usually Flash and Flex applications are embedded on in HTML using either a combination of object and embed tags, or more commonly using JavaScript. However, if you link directly to a SWF file it will open in the browser window and without looking in the address bar you can't tell that it wasn't embedded in HTML with the size set to 100% width and height.

Considering the overhead of the HTML, CSS and JavaScript needed to embed a Flash or Flex application filling 100% of the browser window, what are the downsides of linking directly to the SWF file instead? What are the upsides?

I can think of one upside and three downsides: you don't need the 100+ lines of HTML, JavaScript and CSS that are otherwise required, but you have no plugin detection, no version checking and you lose your best SEO option (progressive enhancement).

Update don't get hung up on the 100+ lines, I simply mean that the the amount of code needed to embed a SWF is quite a lot (and I mean including libraries like SWFObject), and it's just for displaying the SWF, which can be done without a single line by linking to it directly.

解决方案

Upsides for linking directly to SWF file:

  • Faster access
  • You know it's a flash movie even before you click on the link
  • Skipping the html & js files (You won't use CSS to display 100% flash movie anyway)

Downsides:

  • You have little control on movie defaults.
  • You can't use custom background colors, transparency etc.
  • You can't use flashVars to send data to the movie from the HTML
  • Can't use fscommand from the movie to the page
  • Movie proportions are never the same as the user's window's aspect ratio
  • You can't compensate for browser incompetability (The next new browser comes out and you're in trouble)
  • No SEO
  • No page title, bad if you want people to bookmark properly.
  • No plugin information, download links etc.
  • If your SWF connects to external data sources, you might have cross domain problems.
  • Renaming the SWF file will also rename the link. Bad for versioning.

In short, for a complicated application - always use the HTML. For a simple animation movie you can go either way.

这篇关于直接链接到 SWF,有什么缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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