基于Ajax的应用程序中的问题 [英] Issues in Ajax based applications

查看:57
本文介绍了基于Ajax的应用程序中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对开发基于Ajax的应用程序非常感兴趣.这就是通过XMLHttpRequest加载应用程序的几乎所有内容,而不仅仅是一些组合和窗口小部件.但是,如果我尝试从头开始创建此表格,很快就会发现一些问题,而没有简单的解决方案.我想知道是否存在一些框架(客户端和服务器端)来处理此问题.据我所知,还没有(但是我主要在Java世界中进行过搜索).因此,我认真地考虑至少在我的项目中建立自己的框架.

I'm very interested in developing Ajax based applications. This is, loading almost all of the content of the application via XMLHttpRequest, instead of only some combos and widgets. But if I try to do this form scratch, soon I find some problems without an easy solution. I wonder if there is some framework (both client and server side) to deal with this issues. As far as I know, there isn't (but I've searched mainly in Java world). So I am seriously thinking of doing my own framework, at least for my projects.

因此,在这个问题上,我要问几件事.首先,基于ajax的开发可能存在的问题.然后,我正在寻找某种框架或实用程序来处理它们.最后,如果没有可用的框架,它必须具备什么功能.

Therefore, in this question I ask for several things. First, the possible problems of an ajax based development. Then, I'm looking for some framework or utility in order to deal with them. Finally, if there is no framework available, what features must it have.

这是我认为的问题:

1-必须启用JavaScript.安全妄想不是唯一的问题:很多移动设备也无法使用该应用程序.

1 - JavaScript must be enabled. Security paranoia isn't the only problem: a lot of mobile devices couldn't use the application, too.

2-有时您需要更新多个DIV(例如主要内容,菜单和面包屑).

2 - Sometimes you need to update more than one DIV (e.g. main content, menu and breadcrumbs).

3-未知响应类型:当您进行Ajax调用时,还设置了回调函数,通常指定期望的响应是JavaScript对象还是DIV将结果放入其中.但是,当您收到另一种类型的响应时,此操作将失败:例如,当会话到期时,用户必须再次登录.

3 - Unknown response type: when you make an Ajax call, you set the callback function too, usually specifying if expected response is a javascript object or in which DIV put the result. But this fails when you get another type of response: for example when the session has expired and the user must log in again.

4-浏览器的刷新,后退和前进按钮可能真是麻烦.用户会根据情况期望不同的行为.

4 - Browser's refresh, back and forward buttons can be a real pain. User will expect different behaviors depending on the situation.

5-搜索引擎将网站编入索引时,请仅点击链接.因此,对于尚不知道的人,Ajax的内容加载不会存在".

5 - When search engines indexes a site, only follow links. Thus, content load by Ajax won't "exist" for who doesn't know about it yet.

6-用户可以要求在其他窗口/选项卡中打开链接.

6 - Users can ask for open a link in a different window/tab.

7-地址栏不会显示您所在的真实"页面.因此,您无法复制该位置并将其发送给朋友或将该页面添加为书签.

7 - Address bar doesn't show the "real" page you are in. So, you can't copy the location and send it to a friend or bookmark the page.

8-如果您想通过该网站获利,则可以投放一些广告.由于您没有刷新整个页面,并且想要在一段时间后更改广告,因此您只需要刷新广告所在的DIV.但这可能违反广告服务的条款.实际上,它可能违反AdSense TOS.

8 - If you want to monetize the site, you can put some advertisings. As you don't refresh entire page and you want to change the ad after some time, you have to refresh only the DIV where the ad is. But this can violate the Terms and Conditions of your ad service. In fact, it can go against AdSense TOS.

9-刷新整个页面时,所有JavaScript都会清除".但是在Ajax调用中,所有JavaScript对象都将保留.

9 - When you refresh an entire page, all JavaScript gets "cleaned". But in Ajax calls, all JavaScript objects will remain.

10-您无法轻松更改CSS属性.

10 - You can't easily change your CSS properties.

推荐答案

  1. http://icant.co.uk/articles/pragmatic-渐进增强/#build
  2. 是的.这就是为什么您遵循MVC模式而不仅仅是返回m的原因 arkup
  3. 请参阅2.
  4. http://developer.yahoo.com/yui/history/或类似
  5. 请参阅1.
  6. 请参阅1.
  7. 请参见4,但这并不完美,为什么Ajax可以用于Web应用程序但很差 用于网站
  8. 您需要选择可以使用的广告服务
  9. 请参阅4.
  10. 为什么不呢?
  1. http://icant.co.uk/articles/pragmatic-progressive-enhancement/#build
  2. Yes. This is why you follow an MVC pattern and don't just return a chunk of m arkup
  3. See 2.
  4. http://developer.yahoo.com/yui/history/ or similar
  5. See 1.
  6. See 1.
  7. See 4, but this is imperfect and why Ajax is OK for web applications but bad for web sites
  8. You need to pick an ad service that you can work with
  9. See 4.
  10. Why not?

这篇关于基于Ajax的应用程序中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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