UIWeb视图打开新窗口

UIWebview open new window

本文关键字:窗口 新窗口 视图 UIWeb      更新时间:2023-09-26

我有一个第三方网页,它动态创建Form元素并提交到新窗口。。。

有什么办法可以让我知道网页打开了新窗口吗?

这是示例代码。

function open_new_window(target){
      var postForm = document.createElement("form");
      postForm.setAttribute("name","printForm");
                  postForm.setAttribute("action","testpage?timeInMillis=" + new Date().getTime());
      postForm.setAttribute("target",target);
      postForm.setAttribute("method","post");
//other code....
      var parent = document.getElementById(parentId);
      parent.appendChild(postForm);
      postForm.submit();
      parent.removeChild(postForm);
    }

我已经尝试了很多方法,并进行了搜索,但没有找到任何解决方案。

看看UIWevViewDelegae,尤其是

webView:shouldStartLoadWithRequest:navigationType:

在这里,您可以检测要加载的URL Web视图,并采取相应的行动。