Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8033] MobileWeb: WebView - The content of the property "html" is undefined after listening for the load event

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-19T22:46:47.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsMobileWeb
Labelsqe-mw020912
ReporterMichael Pettiford
AssigneeChris Barber
Created2012-03-15T11:00:48.000+0000
Updated2017-03-03T23:59:09.000+0000

Description

Steps to reproduce 1. Create a default mobile web project and replace the code in app.js with the following
var win = Titanium.UI.createWindow({
			title : 'test',
			backgroundColor : 'white'
		});
		var web = Ti.UI.createWebView({
		    url: 'http://appc.me/test/Echo',
		    width: '90%', height: '90%', top: '5%', left: '5%'
		});
		win.add(web);
		
		web.addEventListener('load', function() {
		    // The server returns just 'GET', but iOS forces the web view to be well formed...
		    Ti.API.info(web.html);
		    // So we'll accept either a well formed HTML or the literal response from the server.
		    if (web.html == '<html><head></head><body>GET</body></html>' || web.html == 'GET') {
		        _window.backgroundColor = '#0f0';
		        alert('PASS: I love you forever!');
		    }
		    // Otherwise... FAIL!
		    else {
		        _window.backgroundColor = '#f00';
		        alert('FAIL: web.html != expected html');
		    }
		});
win.open();
2. Run the app Actual result: The content of html is undefinded Expected result: The content of html is GET

Comments

  1. Bryan Hughes 2012-03-19

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/1751 Note: this test will still fail with the new implementation for two reasons: 1) unless the test app itself is running on appc.me, then the test will fail because the iframe is cross-domain 2) Some browsers like to inject extra attributes and remove the tags. For example, Safari returns "GET", not "GET"
  2. Lee Morris 2017-03-03

    Closing ticket as MobileWeb is no longer supported.

JSON Source