I am working on an iOS application in which I am trying to use UIWebView to display various websites. I recently finished the logic to insert Javascript in a UIWebView to catch instances of window.open , window.close and window.opener.focus . In short, for this I am adding JS, which overrides the aforementioned JS functions, which includes creating an iframe with a special scheme that I can catch in the webView:shouldStartLoadWithRequest:navigationType application. Now everything works fine, including window.open , creating a new UIWebView , rather than loading in the same window.
Now, however, a problem has arisen where there is no acceptable solution for JS communication between windows. If the child window tries to call window.opener or window.parent , it always returns a null value and therefore it cannot return to the original web view.
In an attempt to see that iOS browsers can effectively communicate between windows, I found that of the nine browsers that I have on my iPhone, only Safari was able to efficiently execute this message. This makes me think that there is something with the UIWebView that prevents possible full communication between the JS window.
Has anyone been successful in getting a UIWebView for full integration with all JS logic, namely between window-window dialog? Or do you have evidence that JS communication between windows is not possible? Any direction or advice is welcome. Thanks!
source share