[TIMOB-8033] MobileWeb: WebView - The content of the property "html" is undefined after listening for the load event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-19T22:46:47.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.0.0, Sprint 2012-06 |
Components | MobileWeb |
Labels | qe-mw020912 |
Reporter | Michael Pettiford |
Assignee | Chris Barber |
Created | 2012-03-15T11:00:48.000+0000 |
Updated | 2017-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
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"
Closing ticket as MobileWeb is no longer supported.