Created
February 2, 2012 18:49
-
-
Save shazron/1725083 to your computer and use it in GitHub Desktop.
PhoneGap/Cordova: Open a url in the same UIWebView programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
Is this function necessary anymore? With the latest PhoneGap 2.2.0, I just wrote:
window.location.href = url;
its not work too
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorry, remove the line
anchor.setAttribute('target', '_self');