Skip to content

Instantly share code, notes, and snippets.

@Bek
Forked from shazron/gist:1725083
Created April 9, 2012 07:01
Show Gist options
  • Save Bek/2342056 to your computer and use it in GitHub Desktop.
Save Bek/2342056 to your computer and use it in GitHub Desktop.
PhoneGap/Cordova: Open a url in the same UIWebView programmatically
function openInWebView(url)
{
var anchor = document.createElement('a');
anchor.setAttribute('href', url);
//anchor.setAttribute('target', '_self');
var dispatch = document.createEvent('HTMLEvents')
dispatch.initEvent('click', true, true);
anchor.dispatchEvent(dispatch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment