【问题标题】:URL being truncated using UIWebView shouldStartLoadWithRequest使用 UIWebView shouldStartLoadWithRequest 截断 URL
【发布时间】:2012-01-10 08:05:05
【问题描述】:

我正在加载本地网页并使用以下方法拦截网络点击:

  • (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request 导航类型:(UIWebViewNavigationType)导航类型

但是,如果 html 中有这样的内容:

href="http://www.zagat.com/Verticals/PropertyDetails.aspx?VID=8&R=36121">

(如果没有正确显示,我无法在此站点上正确传递 XML,但它不是要查看的 XML,而是 href url)

如果我有这个,那么在 shouldStartLoadWithRequest 中:

NSString *scheme = [[请求 URL] 方案]; NSString *host = [[请求 网址]主机];

方案是“http”,主机是“www.zagat.com”。

有没有办法可以提取“www.zagat.com/Verticals/PropertyDetails.aspx?VID=8&R=36121”的完整字符串?

【问题讨论】:

    标签: ios


    【解决方案1】:

    使用NSString * fullURL = [[request URL] absoluteString];

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-21
      • 1970-01-01
      相关资源
      最近更新 更多