Within a setTimeout, I am setting the location of a newly opened window. To avoid the pop-up blocker, the window is opened with a temporary local URL, and then location is changed to the target URL. This works fine on all desktop browsers including Safari.
However, in Mobile Safari, the location of the new window is not updated until the user returns their focus to the originating window i.e. the temporary page is left sitting there.
This is what the relevant bit of the JavaScript/jQuery looks like:
var self = $(this);
if (self.is("a")) {
var clickEventHandler = function(event) {
event.preventDefault();
if (self.attr("target")) {
var newWindow = window.open('loading.htm',self.attr("target"));
var externalURL=self.attr("href");
setTimeout( function() { newWindow.location=externalURL; }, 100 );
}
}
$(this).bind("click", eventHandler);
}