So, after a little research, it turned out that the UIWebView class intentionally ignores the links that will open in a new window (either using the "target" element in the tag, or using javascript in the onClick event).
The only solutions I found was to manipulate the html pages using javascript. Although this works in some cases, it is not bulletproof. Here are some examples:
links = document.getElementsByTagName('a'); for (i=0; i<links.length; i++) { links[i].target='_self'; }
This will change all links that use the target element to point to _self, instead of _blank or _new. This will probably work in all directions and does not present any problems.
Another snippet I found followed the same idea, but with the onClick event:
links = document.getElementsByTagName('a'); for (i=0; i<links.length; i++) { links[i].onclick=''; }
This is just nasty. It will only work if the link tag has the correct href element, and only if the onclick event is used to open a new window (using window.open () or something similar). The reasons why this is unpleasant should not be explained, but one example can be if onClick is used for something other than opening a window - this is a very common case.
I assume that you can continue with this and start executing some line corresponding to the onClick method and check for window.open (), but again, this is really far from ideal.
Jasarien
source share