0

I have an asp.net page with an iframe in it that shows a youtube video. I have buttons that use the youtube api to control the video. I'm finding that often the video doesn't show up, and I have to do a view-refresh to make it work. This problem is limited to Internet Explorer, I believe that Google chrome does not have the same problem.
I've been told not to use iframes at all by a tech support person at the server company that hosts my site. They say people are moving away from iframes, and that I should use other methods of embedding youtube videos.
I could certainly do that, but youtube recommends using iframes, because they are more flexible. If I could make the 'refresh' problem predictable, I would submit it to Microsoft, but I can't figure out why it happens sometimes, but not other times. I could also force a refresh. My question is, does anyone have a clue why this bug is happening. Thanks.

4

1 回答 1

0

IFRAME 内容经常发生这种情况。我相信这与 Internet Explorer 缓存内容的方式有关,但老实说,我不确定细节。

我可以分享的是我们过去在对话框中使用的一个老技巧。

说你的 src 属性是"http://www.youtube.com/watch?v=1wL7RHoDnxs"

您可以在该 GET 字符串上添加一个额外的参数,例如:-

"http://www.youtube.com/watch?v=1wL7RHoDnxs&doesntmatter=203933"

看到那里的额外doesntmatter参数了吗?该值是随机的,或基于时间戳。你的选择。诀窍是每次给 IE 一个不同的 URL。这将阻止它尝试为您的 IFRAME 内容使用缓存。

于 2013-01-17T13:26:33.543 回答