[TIMOB-13662] iOS: Setting html property in web view prevents setUrl from loading page
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-06-01T23:15:12.000+0000 |
Affected Version/s | Release 3.0.2, Release 3.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Neville Dastur |
Assignee | Pedro Enrique |
Created | 2013-04-23T12:17:43.000+0000 |
Updated | 2017-03-16T21:51:44.000+0000 |
Description
*Problem description*
I have a webview that on start up is empty on an iOS as it acts to show detail. So I used the html property to effectively set a default blank page. It seems that setting this property stops setUrl from loading a local resource.
*Steps to reproduce*
1. Run test case, with testpage.html as an additional resource
2. See that "I'm the property" displays rather than "I'm the local page"
3. Comment out the html property to see that now "I'm the local page" displays
*app.js*
var win = Titanium.UI.createWindow({
title : 'Window',
backgroundColor : 'white',
layout : 'vertical'
});
webView = Titanium.UI.createWebView({
width : Ti.UI.FILL,
height : Ti.UI.FILL,
html : '<html><body>I\'m the property</body></html>'
// ^^ Comment out html property to "fix" problem
});
win.add(webView);
webView.setUrl("/testpage.html");
win.open();
*testpage.html*
<html>
<body>
I'm the local page
</body>
</html>
Tested and confirmed on iOS 6 simulator, Ti SDK 3.1 GA.
Any news on a fix for this please?
Seems like the properties of the web view are processed after the window has opened. So the html override the URL. The workaround is to set the url after the window opens:
PR: https://github.com/appcelerator/titanium_mobile/pull/5971/files
Closing ticket as the issue has been fixed.