当我点击指向子页面的链接时,如何在页面页脚中保留一个不重新加载的音乐播放器? [英] How can I keep a music player in the page footer that doesn't reload when I click a link to a subpage?

查看:93
本文介绍了当我点击指向子页面的链接时,如何在页面页脚中保留一个不重新加载的音乐播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图解决这个问题一段时间,并在众多论坛上寻找解决方案。这是我的设置。任何帮助将不胜感激!

I have been trying to solve this problem for a while now and have looked on numerous forums to find a solution. Here is my setup. Any help would be greatly appreciated!

我目前有一个索引页面,在我的内容部分的上方和下方加载JavaScript页眉和页脚。我还有一个标题内的导航链接列表。我的音乐播放器位于页脚中。它不会自动加载(对于那些受到困扰的人),并且我不希望每次有人点击侧面的某个导航链接时重新加载。 我不想为此使用框架;我已经读过,框架只允许我刷新页面的内容部分,但是在索引网站时,大多数搜索引擎都不适用于有框架的网站。我也不想为我的音乐使用弹出窗口,因为大多数浏览器和用户都会阻止弹出窗口。

I currently have a index page that loads a JavaScript header and footer above and below my "content" section. I also have a list of navigation links inside of the header. My music player is located in the footer. It does not load automatically (for those that are bothered by that), and i don't want it to reload every time someone clicks on one of the navigation links on the side. I don't want to use frames for this; I have read that frames will allow me to only refresh the "content" section of my page, but that when indexing a site, most search engines will not work well with a site that has frames. I also do not want to use a pop-up for my music as most browsers and users have pop-ups blocked.

基本上我正在寻找代码或者其他东西当有人点击我标题中的导航链接时,将允许页眉和页脚(不必是JS页眉和页脚)不刷新。再次感谢任何有此问题解决方案的人。

Basically i am looking for a code or something that will allow for a header and footer (doesn't have to be a JS header and footer) to not refresh when someone clicks on the navigation links located in my header. Thanks again to anyone that has a solution to this problem.

推荐答案

像Facebook一样 - 使用JavaScript截取链接导航,使用XMLHttpResponse加载内容,然后更新页面的部分需要更改。

Do it like Facebook - use JavaScript to intercept link navigation, load the content using XMLHttpResponse, and then update the portions of the page that need to change.

这样可以保持搜索引擎页面的静态完整性,允许大多数网站对禁用脚本的用户仍然正常工作,并避免重置其他人的音乐。

This keeps the static integrity of the page for search engines, allows most of the site to still work just fine for users with scripting disabled, and avoids resetting the music for everyone else.

这篇关于当我点击指向子页面的链接时,如何在页面页脚中保留一个不重新加载的音乐播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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