AJAX和浏览器后退按钮 [英] AJAX and the Browser Back Button

查看:114
本文介绍了AJAX和浏览器后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行一个基于浏览器的游戏,在www.darknovagames.com。最近,我一直在努力重新格式化网站的CSS,试图让所有的页面根据HTML标准验证。

I run a browser based game at www.darknovagames.com. Recently, I've been working on reformatting the site with CSS, trying to get all of its pages to verify according to the HTML standard.

我一直在酝酿这个想法有左边AJAX导航菜单的页面中(而不是每次都采取用户一个单独的页面,需要标题和导航栏,它几乎从来没有变化的重新加载)我知道,如果我这样做,我可能会打破前进/后退按钮在浏览器中。我的问题我想是的,我应该继续和AJAX的部位,因此要求使用的网站导航玩游戏的用户,或者我应该离开现场,因为它目前为,并使用导航标准的超链接和东西?

I've been toying with this idea of having the navigation menu on the left AJAX the pages in (rather than taking the user to a separate page each time, requiring a reload of the title and nav bar, which almost never change) and I know that if I do so, I will probably break the Forward/Back buttons in the browser. My question I guess is, should I go ahead and AJAX the site, thus requiring the user to use the sites navigation to play the game, or should I leave the site as it currently stands, and use standard hyperlinks and things for navigation?

我问我猜的原因是,我建立了一个论坛系统进入该网站,很多时候我会想的论坛内链接说一个特定的主题。

The reason I ask I guess is that I built a forums system into the site, and a lot of times I would want to link say to a particular topic within the forums.

我也愿意听取建议。有没有一个标准(preferably没有传统框架)的方式,使只是身体方面的网站重装,同时还改变了网址,使用户可以收藏和前进/后退等?这可能会解决我的问题也是如此。我只是要求的最佳解决方案在这里,没有回答一个具体的问题。 ^ _ ^

I'm also open to suggestions. Is there a standard (preferably without traditional frames) way to make only the body area of the site reload, while still changing the URL so that users can bookmark and forward/back, etc? That could potentially solve my problem as well. I'm just asking for the best solution here, not an answer to a specific question. ^_^

感谢

推荐答案

如果你要实现AJAX,不要在其网站上的每一个显著页面访问网址为代价的去做。这是一个导航的网站,人们可以使用的骨干力量。

If you're going to enable AJAX, don't do it at the expense of having accessible URLs to every significant page on your site. This is the backbone of a navigable site that people can use.

在铲所有的功能整合到AJAX调用和回调,你基本上是迫使用户到一个单一的路径来访问他们想要的功能和内容 - 这完全是对网络如何为了工作。人靠的地址栏和后退按钮上。如果覆盖所有的链接,使您的​​网站基本上是一个单一的页面,通过AJAX,你限制你的用户的浏览您的网站并找到他们所需要的能力,只有更新。它也停止你的用户能够分享他们的发现(其中,这一点的一部分,对吧?)。

When you shovel all your functionality into AJAX calls and callbacks, you're basically forcing your users into a single path to access the features and content that they want -- which is totally against how the web is meant to function. People rely on the address bar and the back button. If you override all your links so that your site is essentially a single page that only updates through AJAX, you're limiting your users' ability to navigate your site and find what they need. It also stops your users from being able to share what they find (which, that's part of the point, right?).

想想用户的心理你的网站地图。如果他们知道自己排在通过主页,然后他们去寻找的东西,然后他们登陆了游戏页面,然后他们开始玩特定的游戏,这是行动的四个不同单位用户了。他们可能已经做了一些其他的更小,更猥琐这些页面的行为 - 但这些是主要的单位。当他们单击后退按钮,就应该想到回去通过他们进来的路径。如果您正在加载所有这些页面通过AJAX调用,你提供一个网站,其功能有悖于用户期望的结果。

Think about a user's mental map of your site. If they know they came in through the home page, then they went to search for something, then they landed on a games page, then they started playing a particular game, that's four distinct units of action that the user took. They might have done a few other smaller, more insignificant actions on each of these pages -- but these are the main units. When they click the Back button, they should expect to go back through the path they came in on. If you are loading all these pages through AJAX calls, you're providing a site whose functionality runs contrary to what the user expects.

将您的网站出到每一个显著的功能(如搜索,家庭,型材,游戏 - 它会在你的网站是怎么一回事决定)。任何你链接到这些网页,做通过常规链接和一个静态的URL。

Break your site out into every significant function (ie, search, home, profiles, games -- it'll be dictated by what your site is all about). Anywhere you link to these pages, do it through a regular link and a static URL.

AJAX是好的。但它的艺术是知道什么时候使用它,什么时候不。如果你坚持的模式,我已经勾勒出以上,用户将AP preciate吧。

AJAX is fine. But the art of it is knowing when to use it and when not to. If you keep to the model I've sketched out above, your users will appreciate it.

这篇关于AJAX和浏览器后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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