一个UIWebView和IPhone内容不回传(ASP.NET浏览器能力的问题) [英] UIWebview and IPhone content does not postback (ASP.NET Browser Capability issues)

查看:246
本文介绍了一个UIWebView和IPhone内容不回传(ASP.NET浏览器能力的问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的页面,它的结构如下(伪code):

I have a simple page, it's structure is as follows (pseudo code) :

<aspx page>
    <ascx control>
        <asp:dropdownlist id="dd1" autoPostback=true />
        <asp:dropdownlist id="dd2" />
    </ascx control>
</aspx page>

在任何桌面浏览器,DD1的帖子后面和的SelectedIndexChanged服务器事件。然而,在IPhone的Safari或IPhone的WebView,没有回发就完成了。我知道这是因为没有显示的网络活动指示灯,我已经迷上一个调试器来捕获所有的服务器端事件的网站,这是从来没有击中。有时,大约每2个小时,回发DOES在iPhone上工作,但极为罕见和间歇性。

In ANY desktop browser, dd1 posts back and the "SelectedIndexChanged" server event is fired. However in the IPhone safari or an IPhone webview, no postback is done. I know this because no network activity indicator is shown and I've hooked a debugger to the site that catches all serverside events and it is never hit. Sometimes, about once every 2 hours, the postback DOES work on the iphone, but extremely rarely and intermittently.

DD1是加载时隙下拉是依赖于在日期下拉列表中选择的项目的日期下拉菜单。在许多地方,这种形式被重新使用,我并不想改变的基本结构,除非它是最后的努力。

Dd1 is a date dropdown that loads a time slot drop down that is dependent on the selected item in the date dropdown. This form is re-used in many places and I don't want to change the basic structure unless it's a last ditch effort.

JavaScript是在Safari设置中启用。

Javascript is enabled in safari settings.

够简单吧?我试图找出如何调试上的WebView JavaScript错误,但我想知道是否有人知道这是什么古怪创建这一行为。

Simple enough right? I'm trying to figure out how to debug javascript errors on a webview, but I was wondering if anyone knew what oddity it was that created this behavior.

推荐答案

iPhone的UIWebView中的用户代理不是由ASP.NET 4.0的认可,所以asp.net担任了一个默认情况下,页面的下层版本,没有包括的JavaScript。 iPhone的网页流量的用户代理是:

The user agent of the IPhones UIWebView was not recognized by ASP.NET 4.0, so asp.net served up as a default, the Downlevel version of the page which included no javascript. The iphones webview user agent was:

的Mozilla / 5.0(iPhone; U; CPU的iPhone OS 4_3_5,例如Mac OS X; EN-US)为AppleWebKit / 533.17.9(KHTML,例如Gecko)手机/ 8L1

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1

要避免这种情况发生,我改变它绕过asp.net试图找出浏览器功能,只是提供了一个Uplevel版本的页面为UpLevel的ClientTarget财产JavaScript和所有。

To avoid that happening I changed the "ClientTarget" property of the page to "UpLevel" which bypasses asp.net trying to figure out the browser capabilities and just serves up an "Uplevel" version javascript and all.

解决方案在我的页面的Page_Load中:

Solution in my Page's Page_Load:

Me.ClientTarget =uplevel

Me.ClientTarget = "uplevel"

this.ClientTarget =uplevel;

this.ClientTarget = "uplevel";

这篇关于一个UIWebView和IPhone内容不回传(ASP.NET浏览器能力的问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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