Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5599] MobileWeb: Ti.UI.currentWindow.close() closes the page in webView first.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-13T00:26:05.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsMobileWeb
Labelsn/a
ReporterMisha Vasko
AssigneeMaxim Negadaylov
Created2011-06-10T06:17:31.000+0000
Updated2017-03-09T20:32:03.000+0000

Description

Method Ti.UI.currentWindow.close() closes the page which is in the webView object first. and after second using of this method the working window will be closed. How to represent: Click 'Change HTML', then try to close window by clicking 'Close' button. Window will close after second click.
var win = Titanium.UI.currentWindow;
win.backgroundColor = '#fff';

var webView1 = Ti.UI.createWebView({
	height:100,
	width:300,
	top:10,
	left:10,
	backgroundColor:'#336699',
	borderRadius:10,
	html:'<div style="color:#fff">I am a web view with in-line HTML</div>'
});

win.add(webView1)

var changeHTML = Ti.UI.createButton({
	title:'Change HTML',
	height:40,
	left:10,
	top:120,
	width:300,
	font:{fontSize:20}
});
win.add(changeHTML);
	
changeHTML.addEventListener('click', function(){
	webView1.html = '<div style="color:#fff">Changed</div>';
	alert('it worked ' + webView1.html)
});

var remoteURL = Ti.UI.createButton({
	title:'Remote URL',
	height:40,
	left:10,
	top:170,
	width:300,
	font:{fontSize:20}
});
win.add(remoteURL);
	
remoteURL.addEventListener('click', function(){
	var webView2 = Ti.UI.createWebView({
		height:100,
		width:300,
		top:10,
		left:10,
		backgroundColor:'#336699',
		borderRadius:10,
		url:'/examples/window.html'
		
	});
	win.add(webView2);

});

var close = Ti.UI.createButton({
	title:'Close',
	height:40,
	top:220,
	left:10,
	width:300,
	font:{fontSize:20}
});
win.add(close);
	
close.addEventListener('click', function(){
	win.close();
});

Comments

  1. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source