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

      <small id='b8anC'></small><noframes id='b8anC'>

        在 UIWebView 中打开弹出链接,可能吗?

        Opening popup links in UIWebView, possible?(在 UIWebView 中打开弹出链接,可能吗?)
          <tbody id='9xhzN'></tbody>

        • <legend id='9xhzN'><style id='9xhzN'><dir id='9xhzN'><q id='9xhzN'></q></dir></style></legend>
              <bdo id='9xhzN'></bdo><ul id='9xhzN'></ul>
              <tfoot id='9xhzN'></tfoot>
              • <small id='9xhzN'></small><noframes id='9xhzN'>

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

                  本文介绍了在 UIWebView 中打开弹出链接,可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UIWebView,在我的应用中用作嵌入式浏览器.

                  I have a UIWebView which I'm using as an embedded browser within my app.

                  我注意到打开新窗口的网页中的链接会被忽略,而无需调用我的代码.

                  I've noticed that links in webpages that open new windows are ignored without any call into my code.

                  我试过断点

                  - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
                  

                  然后选择一个会打开一个弹出窗口的链接,并且断点永远不会被命中.我能做些什么来拦截弹出链接的选择并获取 URL 并正常加载它吗?

                  and then selecting a link that would open a popup window, and the breakpoint is never hit. Is there anything I can do to intercept that selection of the popup link and get the URL and just load it normally?

                  我对在应用程序本身中显示弹出窗口不感兴趣,我只想将要在弹出窗口中加载的任何内容的 URL 加载到主 web 视图本身中.

                  I'm not interested in displaying a popup window in the app itself, I just want the URL of whatever is going to be loaded in the popup window to load in the main webview itself.

                  这可能吗?

                  谢谢!

                  推荐答案

                  我也遇到了这个问题,HTML 重写是我能想到的最好的解决方案.我在使用这种方法时遇到的最大问题是,在调用 webViewDidFinishLoad: 方法之前,Web 浏览器最多可以交互几秒钟,因此链接似乎会中断几秒钟,直到它们被重写.

                  I ran into this as well, and HTML rewriting was the best solution I could come up with. The biggest issue that I ran into with that approach is that the web browser is interactive for up to a couple of seconds until the webViewDidFinishLoad: method is called, so the links seem to be broken for a few seconds until they're rewritten.

                  我重写了三个区域:链接、表单帖子和对 window.open() 的调用.

                  There's three areas that I rewrote: links, form posts, and calls to window.open().

                  我对 Jasarian's 答案中的第一段代码使用了类似的方法,通过迭代覆盖链接和表单的目标在标签和表格上.为了覆盖 window.open,我使用了类似于以下的代码:

                  I used a similar approach to the first code snipped in Jasarian's answer to overwrite the target for links and forms by iterating over tags and forms. To override window.open, I used code similar to the following:

                  var oldWindowOpen = window.open;
                  window.open = function(url, sName, sFeatures, bReplace) {
                    oldWindowOpen(url, '_self');
                  };
                  

                  这篇关于在 UIWebView 中打开弹出链接,可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                  ImageIO: lt;ERRORgt; JPEG Corrupt JPEG data: premature end of data segment iphone - how to catch this?(ImageIO:lt;错误gt;JPEG 损坏的 JPEG 数据:iphone 数据段过早结束 - 如何捕捉到这个?)
                  Xcode iOS organizer submit to app store yields quot;The archive is invalidquot; error(Xcode iOS 管理器提交到应用商店产生“存档无效;错误)
                  MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                  How to add and get the values from .plist in iOS(如何在 iOS 中从 .plist 添加和获取值)
                  Mobile Device Management with iPhone(使用 iPhone 进行移动设备管理)
                      <bdo id='A0gQr'></bdo><ul id='A0gQr'></ul>

                            <tbody id='A0gQr'></tbody>

                        1. <small id='A0gQr'></small><noframes id='A0gQr'>

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