1
我在MVC 3网站上使用jQuery Mobile。除了我有一个链接到返回RedirectResult的控制器操作的标签以外,运行良好。它看起来像jQuery拦截链接,每次都出错。我收到移动框架输出的标准“发生错误”消息。用Firebug检查响应显示响应完全是空的。jQuery Mobile不支持MVC RedirectResult
我听说可能有一个数据属性,我需要添加到标记,使移动用户界面忽略它?任何想法或其他解决方案?
编辑:为了说明问题,URL正在正确生成,并且是一个有效的URL,它与jQUery mobile拦截请求的方式有关。
<a href='/[email protected]["URL"]' title="view full site" >view full site</a>
public RedirectResult FullSite()
{
StringBuilder redirectUrl = new StringBuilder("http://www.site.com/");
try
{
string referringUrl = Request.QueryString["p"];
if (!String.IsNullOrEmpty(referringUrl) && referringUrl.Contains("photo-gallery"))
referringUrl = referringUrl.Replace(@"/photo-gallery", String.Empty);
redirectUrl.Append(referringUrl);
}
catch (Exception)
{
redirectUrl.Clear();
redirectUrl.Append("http://www.site.com");
}
CookieManager.SetMobileToFullSiteCookie();
return new RedirectResult(redirectUrl.ToString());
}
这工作,谢谢。 – Scott 2011-03-04 18:40:09
我想我更喜欢data-ajax。似乎更多的jQuery手机。 :) – Scott 2011-03-04 18:44:28
@Scott,对于你想重新加载的实际内部链接,我同意。我的用例实际上是一个外部链接,'rel =“external”'更符合语义。 – tvanfosson 2011-03-04 18:46:31