我正在为一个乐队制作一个网站,我想知道在网站上播放背景音乐而不中断音乐流(即使是一瞬间)的最佳方式。
目前,我正在考虑使用框架,但这不应该是一个好的做法。请有人告诉我我该怎么做。我更喜欢使用 HTML 对网站进行编码,因为我还没有掌握 Flash 编码。
我正在为一个乐队制作一个网站,我想知道在网站上播放背景音乐而不中断音乐流(即使是一瞬间)的最佳方式。
目前,我正在考虑使用框架,但这不应该是一个好的做法。请有人告诉我我该怎么做。我更喜欢使用 HTML 对网站进行编码,因为我还没有掌握 Flash 编码。
This might sound controversial, but here's an idea: Don't play music on your website. Seriously, don't. I think everyone knows how incredibly annoying that is, and asking a group of software developers to help you out with that is going to be like asking a group of sheep the best way to make a lambskin coat.
If you really have to do it, frames would be the simplest way, so I'd do that. But you're not going to do it anyway, right?
I can think of four ways:
防止音乐停止的唯一方法是不要让您的音乐组件所在的页面重新加载。不幸的是,目前唯一的方法是使用框架。
The only alternative is to develop the whole site in Flash or another technology that doesn't rely on changing pages as navigation.
It wouldn't be pretty but you could do it using AJAX. Have the master page with the header/footer/navigation controls with a big empty content div, and instead of regular links you have calls to AJAX functions that return HTML to be injected in the content div.
I tend to agree with the others who recommend frames. It may be considered "bad practice", but so is playing background music in the first place.
As was said, to do that you have to prevent your website from relaoding.
An option to achieve this might be to use asynchronous requests to modify your website content without reloading the whole page, that's basically what Ajax is about.
That being said, I sort of agree with Alex here : dont' play music.
This may be a topic for another post, but why would you cosnider IFrames to be good practice? you could out the content you want to change into an IFrame and have your code running your music player ouside it. When you load a page it woul load on the IFrame. Just a thought...
您很可能需要闪光灯或窗口外的新窗口(弹出窗口)。
不要使用框架。曾经。
编辑:对于所有对此进行修改和评论的人,没有一个人给出了你应该使用框架的正当理由。
只是为了澄清我的立场,请阅读任何关于可用性、网络和框架的文章。
对于那些仍在学习的人(以及那些愚蠢地更新的老人)
框架打破了网络的统一模型。
框架会给搜索引擎机器人带来问题。
框架使 URL 停止工作。
框架打破书签。
框架使打印更加困难。
框架会损害可访问性。
框架增加了技术复杂性。
以及不使用框架的第一大理由......
用户讨厌他们!
http://www.456bereastreet.com/archive/200411/who_framed_the_web_frames_and_usability/
真的有这么多人在 2009 年建议框架是一个有效的解决方案吗?多么令人失望。