阿贾克斯深层链接? [英] Ajax deep linking?

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

问题描述

我已经做了一个Flex应用程序深层链接之前,但现在我想打一个Ajax应用程序深层链接。

I have made a flex app deep link before but now I want to make an ajax app deep link.

我不知道从哪里开始。

我想我需要一种方法来听的时候#hash在url中的变化,并能够读取它。我想我需要一个方法来更新在URL中#hash。

I assume I need a way to listen for when the #hash in the url changes and be able to read it. And I assume I need a way to update the #hash in the url.

有谁知道怎么做呢?

谢谢!

推荐答案

你是在正确的轨道。

有关的AJAX页面,您希望能够链接到,改变散列标签每一个状态:

For each state of the ajax page that you want to be able to link to, change the hash tag:

window.location.hash = "this_state"

在页面加载,你需要检查window.location.hash值相匹配的国家之一,如果它确实使应用程序进入该国。 (听哈希标签的变化是网页加载。)

When the page loads you'll need to check if the window.location.hash value matches one of your states and if it does make the app go to that state. ("Listening" for the change of the hash tag is the page loading.)

这样,你的用户可以书签和共享状态,使得一个更加实用的应用程序,所以道具关心它。

This way your users can bookmark and share the states, making for a much more usable app, so props for caring about it.

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

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