vkontakte.ru 中的音频播放器是如何完成的
俄罗斯社交网络中有一个在线播放音乐的功能。没什么特别的,但即使我在网站上导航,音乐也会继续播放。所以 URL 正在改变(不是哈希部分),但音乐播放得很流畅。
它是如何完成的?我只是好奇这些人是如何做得这么好。
In russian social network there is a functionality to play music online. Nothing special but music continues playing even if I'm navigating on the site. So Url is changing (not hash part) but music is playing smoothly.
How is it done? Just I'm curios how these guys did it so well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
杜兹是对的。他们使用 AJAX 调用来刷新除实际音乐/视频播放器之外的所有页面。如果您查看 Firefox 中的 Firebug,您会发现,当您单击页面时,NET 请求不会刷新,而是会添加到主队列中。尝试打开音乐播放器、firebug(网络面板)并切换页面。享受。
Dutzi is correct. They are using AJAX calls to refresh all of the page other than the actual music/video player. If you look at Firebug in Firefox, when you click on a page the NET requests are not being refreshed they are being done added to the main queue. Try opening up a music player, firebug(net panel) and switching pages around. Enjoy.
页面不会重新加载,它只是 ajax 请求更改页面的部分内容或 iframe。
对于网址栏,他们可能使用类似 swfaddress 的内容。
The page doesn't reload, it's just ajax requests changing parts of the page, or an iframe.
For the URL bar, they're probably using something like swfaddress.
所以他们通过 JavaScript 使用历史操作。这样他们就可以修改浏览器的 url,而无需重新加载页面。
示例可以在 mozilla 页面查看
So they are using history manipulation via javascript. This way they modify the url of the browser without reloading the page.
Examples can be seen on mozilla page