[
https://issues.apache.org/jira/browse/CB-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shazron Abdullah resolved CB-62.
--------------------------------
Resolution: Won't Fix
Workaround is to use the JS function here:
https://gist.github.com/1725083
{code:javascript}
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);
}
{code}
> Unable to use JavaScript to redirect to a different page.
> ---------------------------------------------------------
>
> Key: CB-62
> URL: https://issues.apache.org/jira/browse/CB-62
> Project: Apache Callback
> Issue Type: Bug
> Components: iOS
> Reporter: Shazron Abdullah
>
> **Summary:** You can no longer redirect to a different page by updating
> `document.location.href`.
> reported at: https://github.com/phonegap/phonegap-iphone/issues/270
> by: https://github.com/buddydvd
> **To reproduce:** Add `www.google.com` to `PhoneGap.plist`'s `ExternalHosts`
> array. Add an anchor link to `index.html` with its `onclick` handler set to
> use JavaScript to redirect the webView to`http://www.google.com`.
> <a href="#" onclick="document.location.href='http://www.google.com/';
> return false;">click me</a>
> **Expected:** Clicking the anchor link will load `http://www.google.com` in
> the embedded webView.
> **Actual:** Clicking the anchor link loads `http://www.google.com` in Mobile
> Safari.
> For more info, see:
> https://github.com/phonegap/phonegap-iphone/commit/9eaeceb2048427f2349cbd862af2507bddf08f77
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira