AJAX的iPhone?AJAX、iPhone

2023-09-10 13:23:54 作者:lt(被子)

我有,我已经开发了很体面使用JavaScript,并为一些事情极少使用AJAX的网站。直到我说的函数创建一个Htt的prequest手柄此时iPhone上的所有的Javascript现在静静地失败。所以,我有几个问题。

I have a site that I've developed that makes decent use of Javascript, and minimal use of AJAX for a few things. The site worked fine on the iPhone until I added the function to create an HttpRequest handle at which point all Javascript on the iPhone now silently fails. So, I have a few questions.

(1)看来,AJAX不工作在所有在iPhone上。这是真的?如果没有,我怎么能修改的Htt prequest创建功能,以适应iPhone?

(1) It seems that AJAX does not work at all on the iPhone. IS this true? If not, how can I modify the HttpRequest create function to accomodate the iPhone?

(2)如果AJAX是在iPhone的确是不可能的,是有办法,我可以修改函数给出这样它会正常失败的iPhone和页面上的其他脚本依然会起作用?

(2) If AJAX is indeed impossible on the iPhone, is there a way I can modify the function given so that it will fail gracefully on the iPhone, and other scripts on the page will still function?

(3)如果这是不正确的,什么我需要做服务器端(是这甚至可能吗?)做检测的iPhone,这样我就可以完全去除AJAX code当iPhone请求页?

(3) If this is not true, what do I need to do server side (and is this even possible?) do detect the iPhone, so that I can remove the AJAX code entirely when an iPhone requests the page?

会是什么的也的工作很好地是使用CSS来检测iPhone作为显示设备,并采取相应的行动,类似于您歌剧显示使用的能力。当然,这不会解决AJAX的问题,但它会很整齐。 ^ _ ^

What would also work quite nicely is the ability to use CSS to detect the iPhone as a display device, and act accordingly, similar to what you use with Opera Show. Of course, this wouldn't fix the AJAX issue, but it would be neat. ^_^

感谢您的回答。我的几个客户定期从iPhone访问该网站,我想我的网页的工作尽可能他们可能可以,所以我愿意修改我的code吧,即使我没有之一上测试。

Thanks for answers. Several of my customers access the site regularly from the iPhone, and I want my pages to work as much as they possibly can, so I'm willing to modify my code for it, even though I don't have one to test on.

推荐答案

当然,iPhone的支持AJAX,请的http://开发商.apple.com / webapps /下资源的开发iPhone的webapps一堆。我会建议使用框架(如 jQuery的或的的iUI (用于用户界面)),而不是滚动您自己的Ajax功能,因为它已经解决了很多浏览器的怪癖,并进行优化。

Of course the iPhone supports ajax, check out http://developer.apple.com/webapps/ for a BUNCH of resources for developing iPhone webapps. I would recommend using a framework (such as jQuery, or iUI (for ui)) rather than rolling your own ajax functionality, it will already address a lot of the browser quirks and be optimised.