[TIMOB-8113] Android: Ti.UI.WebView doesn't seem to load pages that try to open a new window
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-04-17T11:28:30.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 2.1.0, Sprint 2012-08 |
Components | Android |
Labels | SupportTeam, api, module_webview, qe-testadded |
Reporter | Junaid Younus |
Assignee | Josh Roesslein |
Created | 2012-03-20T11:25:42.000+0000 |
Updated | 2014-08-21T21:21:11.000+0000 |
Description
*Code*
* app.js
var win = Ti.UI.createWindow();
var webview = Titanium.UI.createWebView({
url: 'index.html'
});
win.add(webview);
win.open();
* index.html
<a href="http://www.google.com" target="_blank">Click to load Google in a new window.</a>
<br></br>
<a href="http://www.google.com">Click to load Google in the same window.</a>
*Expected behavior*
When you click on either of the two links, it should load up Google.
*Actual behavior*
What actually happens, is that the first link doesn't seem to do anything, only the second one seems to work.
*Notes*
-Only tested on a HTC Sensation and Samsung Galaxy S2, both giving me the same result.
-Same result, whether I use the Rhino or V8 engine.
-When testing the same code on the iOS simulator, both links seem to work fine.
-The issue is 'target="_blank"' without this, it seems to work fine.
-HD ticket: http://support-admin.appcelerator.com/display/APP-257637
Submitted PR [#1996](https://github.com/appcelerator/titanium_mobile/pull/1996) to resolve issue. This fixes a new, currently undocumented API
onCreateWindow
callback. Also it adds default behavior if this callback is not set which just opens a new activity window containing the new WebView instance.WebView.onCreateWindow
Use the same index.html in this ticket's description. NOTE: onCreateWindow is not currently public and shouldn't be used yet. This test case is purely for testing purposes.
Re-opening because it looks like the change doesn't work in Rhino: http://pastie.org/3799021
[PR #2013](https://github.com/appcelerator/titanium_mobile/pull/2013) sent to resolve Rhino issue.
Titanium Studio: 2.1.0.201206221045 Mobile SDK: 2.1.0.v20120622174154 OS: X Lion Device: Samsung Galaxy Fixed Both hyperlinks are working and providing the expected result by opening the Google.com