[TIMOB-3123] Android: webview link with new or blank target (ie "popup") does not open
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-04-02T10:53:33.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 2.0.0, Sprint 2012-06 |
Components | Android |
Labels | klist, module_webview, parity, qe-testadded, reported-1.6.0, rplist |
Reporter | Paul Dowsett |
Assignee | Neeraj Gupta |
Created | 2011-04-15T03:37:29.000+0000 |
Updated | 2012-04-02T10:53:33.000+0000 |
Description
Android "APIs 2.2" / Titanium 1.6.0 (11 Feb 2011)
It isn't surprising that this does not work, but I am creating the ticket in the interests of completeness, as the issue has been opened for iOS in ticket #1603 and seems to be confirmed by core devs. Note that the iOS ticket claims that these types of links can be browsed on iOS 4.
Clicking a link in a webview that has a target (new, blank) that would ordinarily open a new window in a standard browser is ignored. The following code demonstrates the behavior:
var win = Ti.UI.createWindow({
backgroundColor: 'white',
exitOnClose:true
});
Titanium.UI.setBackgroundColor('#000');
var webView = Ti.UI.createWebView({
url: "http://www.cnn.com/2010/TECH/social.media/08/12/delta.facebook.ticket.window/index.html",
top: 0,
left: 0,
width: '100%',
height: '100%'
});
webView.addEventListener('load',function(e) {
Ti.API.info("Load event caught with: " + e.url);
});
webView.addEventListener('beforeload',function(e) {
Ti.API.info("beforeload event caught with: " + e.url);
});
win.add(webView);
win.open();
The built-in browser does recognize the link:
var win = Ti.UI.createWindow({
backgroundColor: 'white',
exitOnClose:true
});
Titanium.UI.setBackgroundColor('#000');
win.open();
Ti.Platform.openURL('http://www.cnn.com/2010/TECH/social.media/08/12/delta.facebook.ticket.window/index.html');
I've confirmed this as well. target _blank will not open at all in our webView. On iOS it opens in the current webView in which it was clicked.
HD ticket: http://developer.appcelerator.com/helpdesk/view/76367">http://developer.appcelerator.com/helpdesk/view/76367
rplist'd, klist'd, added TBS Milestone
Bug is still valid, occurs in: TiMOB sdk version: 1.8.0.v20111031173855 Studio version: 1.0.6.201110251616 OS version: Mac OS X Lion Devices tested on: Droid 2.2.2, Galaxy Tab 3.1
Another case here: http://support-admin.appcelerator.com/display/APP-871916 The web view is loaded on iOS, but not on android.
you can temporary fix it like this:
Reopening bug. Still persists on: SDK build: 2.0.0.v20120321071752 Runtime: v8, rhino Titanium Studio, build: 2.0.0.201203202130 Device: Droid 1 (2.2.3) Note: * Above code still works on iOS * I noticed some interesting logs in logcat. But, not sure if it's related:
Reopening/closing to add/remove labels