1. <tfoot id='1uHRi'></tfoot>

      <i id='1uHRi'><tr id='1uHRi'><dt id='1uHRi'><q id='1uHRi'><span id='1uHRi'><b id='1uHRi'><form id='1uHRi'><ins id='1uHRi'></ins><ul id='1uHRi'></ul><sub id='1uHRi'></sub></form><legend id='1uHRi'></legend><bdo id='1uHRi'><pre id='1uHRi'><center id='1uHRi'></center></pre></bdo></b><th id='1uHRi'></th></span></q></dt></tr></i><div id='1uHRi'><tfoot id='1uHRi'></tfoot><dl id='1uHRi'><fieldset id='1uHRi'></fieldset></dl></div>
    1. <small id='1uHRi'></small><noframes id='1uHRi'>

    2. <legend id='1uHRi'><style id='1uHRi'><dir id='1uHRi'><q id='1uHRi'></q></dir></style></legend>
        <bdo id='1uHRi'></bdo><ul id='1uHRi'></ul>

      如何从 UIWebView 获取 URL 的哈希片段

      How to get hash fragment of URL from UIWebView(如何从 UIWebView 获取 URL 的哈希片段)

      • <small id='LOhQj'></small><noframes id='LOhQj'>

          <bdo id='LOhQj'></bdo><ul id='LOhQj'></ul>
          • <i id='LOhQj'><tr id='LOhQj'><dt id='LOhQj'><q id='LOhQj'><span id='LOhQj'><b id='LOhQj'><form id='LOhQj'><ins id='LOhQj'></ins><ul id='LOhQj'></ul><sub id='LOhQj'></sub></form><legend id='LOhQj'></legend><bdo id='LOhQj'><pre id='LOhQj'><center id='LOhQj'></center></pre></bdo></b><th id='LOhQj'></th></span></q></dt></tr></i><div id='LOhQj'><tfoot id='LOhQj'></tfoot><dl id='LOhQj'><fieldset id='LOhQj'></fieldset></dl></div>
          • <legend id='LOhQj'><style id='LOhQj'><dir id='LOhQj'><q id='LOhQj'></q></dir></style></legend>
              <tfoot id='LOhQj'></tfoot>
                <tbody id='LOhQj'></tbody>

              1. 本文介绍了如何从 UIWebView 获取 URL 的哈希片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试在 UIWebView 中加载 URL 的哈希片段,我尝试了不同的方法,但它似乎不起作用.

                I'm trying to get hash fragment of URL loaded in UIWebView, I have tried different approaches it does not seem to work.

                例如,如果 UIWebView 加载了http://www.mysite.com/home#main":

                For example if the UIWebView is loaded with "http://www.mysite.com/home#main":

                NSURL *url = [NSURL URLWithString:@"http://www.mysite.com/home#main"];
                NSURLRequest *request = [NSURLRequest requestWithURL:url];
                [webView loadRequest:request];
                

                然后我想获取完整的网址,但它只返回http://www.mysite.com/home",有 3 种不同的方法:

                then I want to get the full url, but it only return "http://www.mysite.com/home" with 3 different approaches:

                1:

                NSString *currentURL = [webView.request.URL absoluteString];
                

                2:

                NSString *currentURL = [NSString stringWithFormat:@"%@",[[webView request] URL]];
                

                3:

                NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location.hash"];
                

                我错过了什么

                推荐答案

                试试 NSString *fragment = [webView.request.URL fragment];

                这篇关于如何从 UIWebView 获取 URL 的哈希片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                iOS UIWebView app opens link in Safari(iOS UIWebView 应用在 Safari 中打开链接)
                Close UIWebView using javascript:window.close();(使用 javascript:window.close() 关闭 UIWebView;)
                NSCachedURLResponse returns object, but UIWebView does not interprets content(NSCachedURLResponse 返回对象,但 UIWebView 不解释内容)
                Trouble hiding iAd banner and displaying UIWebView in its place(无法隐藏 iAd 横幅并在其位置显示 UIWebView)
                Knowing when AJAX has loaded in UIWebView(知道何时在 UIWebView 中加载了 AJAX)
                Load image/logo in existing HTML input field - UIWebView(在现有的 HTML 输入字段中加载图像/徽标 - UIWebView)
                  <tbody id='jH3Oe'></tbody>
                  <bdo id='jH3Oe'></bdo><ul id='jH3Oe'></ul>

                  <legend id='jH3Oe'><style id='jH3Oe'><dir id='jH3Oe'><q id='jH3Oe'></q></dir></style></legend>

                  1. <tfoot id='jH3Oe'></tfoot>

                    • <small id='jH3Oe'></small><noframes id='jH3Oe'>

                        • <i id='jH3Oe'><tr id='jH3Oe'><dt id='jH3Oe'><q id='jH3Oe'><span id='jH3Oe'><b id='jH3Oe'><form id='jH3Oe'><ins id='jH3Oe'></ins><ul id='jH3Oe'></ul><sub id='jH3Oe'></sub></form><legend id='jH3Oe'></legend><bdo id='jH3Oe'><pre id='jH3Oe'><center id='jH3Oe'></center></pre></bdo></b><th id='jH3Oe'></th></span></q></dt></tr></i><div id='jH3Oe'><tfoot id='jH3Oe'></tfoot><dl id='jH3Oe'><fieldset id='jH3Oe'></fieldset></dl></div>