围绕对象(即 flash)的 a-href 是否只是一个坏主意,或者实际上是否存在关于如何处理此类对象的点击的标准?

发布于 2024-08-04 07:58:04 字数 677 浏览 3 评论 0原文

我正在和我的一位同事进行这个讨论。他创建了一段代码,在要加载闪存的对象周围放置一个 a-href。当我看到这个时,我几乎哭了,并告诉他改用 clickTag。

他告诉我,它与 a-href 配合得很好。我检查了一下,代码在ie6-8和firefox(都安装了flashplayer 9或10)中运行良好。

因为我知道使用 a-href 是一个非常糟糕的主意,所以我做了一些关于为什么不使用它的研究。

从那里我检查了标准(http://www.w3.org/ TR/html401/struct/objects.html)并用谷歌搜索。

但我没有找到任何解释为什么它应该或不应该工作(我知道有时它不起作用)。

我们最终得到了一个同时使用两者的解决方案 - 周围的 a-href 并传递了 clickTag(仅供参考:我们不知道将显示哪种 swf,因为它来自 cms)。

为什么 a-href/flash 有时起作用,有时不起作用,执行此类操作的“标准”方法是什么?其他包含的对象(svg/movie/audio/..)怎么样?是否有一个标准来定义如何处理此类事物(如点击 Flash 或媒体播放器等嵌入式对象)(即停止传播单击事件)?

I was having this discussion with one of my colleagues. He created a piece of code that put an a-href around an object where a flash is to be loaded. When I saw this I almost cried out and told him to use the clickTag instead.

He told me that it works fine with the a-href. I checked it out, and the code worked fine in ie6-8 and firefox (all having flashplayer 9 or 10 installed).

Since I KNEW that its a really bad idea to use a-href I did a little research about why not to use it.

From there I checked out the standards (http://www.w3.org/TR/html401/struct/objects.html) and googled around.

But I did not find any explanation why it should or should not work (I know sometimes it does not work).

We ended up with a solution to use both - the surrounding a-href and passed the clickTag (fyi: we do not know what kind of swf will be displayed since it comes from a cms).

Why does the a-href/flash sometimes work and sometimes it does not and what would be the "standard" way to do something like that? What about other included objects (svg/movie/audio/..?) Is there a standard that defines how such things (as clicks on embedded objects like flash or a media player) are handled (ie. the javascript way to stop propagating the click event)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

℉服软 2024-08-11 07:58:05

The standard way to do it is to use the [onclick] attribute to pass in a JS expression, or to listen for the click mouse event, once a click has been captured on the inline <embed> and <object> before focus is transferred over to the plug-in.

I'm thinking if the <object> and <embed> wrap around the plug-in content properly, then <a> should wrap properly around <object> and <embed> as well. I'd also like to naturally believe that when <object> and <embed> capture the click mouse event, that it also properly bubbles up. But I'm not 100% sure if this kind of behavior can be altered by the plug-in, causing <a> not getting it's display properly computed or some other event model not firing the event on <a>.

冷弦 2024-08-11 07:58:04

没有针对它的标准,但它肯定会导致跨不同浏览器/平台组合的不可预测的结果。进行简单搜索仔细查看结果表明,很多人在仅超链接 SWF 时遇到了问题。

添加超链接和 clickTag 是毫无意义的,您会重复该功能,因为如果访问者拥有正确版本的 Flash,那么他们将获得 Flash 影片并且将使用 clickTag。您应该做的是将超链接作为后备,这样即使未安装 Flash,人们仍然可以访问您的超链接。 SWFObject 等库使这一切变得非常容易。

There is no standard against it, but it will definitely lead to unpredictable results across different browser/platform combinations. Doing a simple search and going through the results shows that there are many people who have had issues with just hyperlinking the swf.

Adding both the hyperlink and the clickTag is rather pointless, you're duplicating the functionality since if the visitor has the correct version of Flash then they're going to get the Flash movie and the clickTag is going to be used. What you should do is have the hyperlink as a fallback, so that if Flash isn't installed then people can still access your hyperlink. Libraries such as SWFObject make this very easy to do.

醉梦枕江山 2024-08-11 07:58:04

我建议反对。我的电脑运行的是 64 位 Linux,Flash 在 Firefox 中的表现有点奇怪。 (一方面,它的表现就好像 z-index 总是大于其他一切。)我还没有测试过它,但我怀疑它的表现不佳。最重要的是,这是您想要在所有平台上的所有浏览器上测试的事情,如果可能的话最好避免它。

I would recommend against it. My computer is running 64-bit Linux, and Flash behaves a little funny in Firefox. (For one thing, it acts as though the z-index is always greater than everything else.) I haven't tested it, but I suspect it wouldn't behave well. Bottom line is that this is the sort of thing you'd want to test on all browsers on all platforms, and it'd just be better to avoid it if possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文