节约历史阿贾克斯 [英] saving history in ajax

查看:202
本文介绍了节约历史阿贾克斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ajax在我的网站。当用户输入查询并选择一个类别,我跟服务器获取内容使用AJAX更新页面。此外,我更新了散列值,显示查询,并通过&放大器分离类别的URL;

I am using ajax in my site. When a user enters a query and selects a category, I update the page with server fetched content using ajax. In addition I update the URL with a hash value which shows the query and the category separated by a &.

我想要做的就是让它所以当浏览器的后退按钮是pressed我想无需重新加载,显示previous结果。

What I want to do is to make it so when the browser back-button is pressed I want to display the previous result without reloading.

我所得到的是有previous值的URL,但结果没有更新。我怎样才能改变这种状况?任何一个可以帮助我吗?

What I am getting is that URL that has the previous values, but the result is not updating. How can I change that? Can any one help me?

推荐答案

简短的回答是使用URI的#hash部分,这部分如果更新不刷新页面,并且在大多数浏览器,使历史的检验点然而在大多数浏览器说,这意味着在IE6不支持,我认为IE7。 另一种方法是,当你发现IE浏览器,你可以嵌入1个像素的iframe,并设置它的源页面上您的域,使你的JavaScript将它的?该URL的一部分,所以页面刷新,而在这种情况下,IE浏览器将保存历​​史点。 这个问题解决了IE8

The short answer would be use the #hash part of the uri, this part if updated doesn't refresh the page, and in most browsers makes a history checkpoint, however by saying in most browsers, means that no support in IE6, and I think IE7. The other way is when you detect IE, you can embed a 1 pixel iframe and set it's source to a page on your domain, and make your javascript sets its ? part of the url so the page refreshes, and in this case IE will save history point. This problem is solved in IE8

示例

http://codinginparadise.org/weblog/2005/08/ajax-tutorial-tale-of-two-iframes-or.html

这篇关于节约历史阿贾克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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