Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3501] webview reload() does not reload `url` or `html `properties

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T18:55:44.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, defect, reported-1.6.1
ReporterPaul Dowsett
AssigneeIngo Muschenetz
Created2011-04-15T03:45:57.000+0000
Updated2020-01-09T18:55:44.000+0000

Description

Testing using:

  • Titanium Mobile SDK 1.6.1(15 Mar 2011)
  • Android emulator 2.2

The following code demonstrates that webview.reload() does not reload the url or html properties. Hence, although all the other webview properties are retained (ie, width, height, backgroundColor etc), the contents of the webview must be manually reloaded. This workaround is included in the code, where either the url or html properties are reassigned:

app.js:

var win = Ti.UI.createWindow();

var thisHTML = "<html><body><button onClick=\"Ti.App.fireEvent(\'alert\');\">Click me to fire an alert</button><button onClick=\"Ti.App.fireEvent(\'reload\');\">Click me to reload webview</button></body></html>";

var webview = Ti.UI.createWebView({
    backgroundColor:"red",
    url:"webview.html", // contents will not be reloaded on webview.reload()
//  html:thisHTML, // this will also exhibit the problem when webview.reload() is used
    height:300,
    width:300
});
 
Ti.App.addEventListener("reload", function(){
    Ti.API.info("Reloaded Webview");
    alert("fireEvent from webview - reload Webview");
    webview.reload();
//  webview.url = "webview.html"; // this can be used as a workaround
//  webview.html = thisHTML; // this can be used as a workaround
});
 
Ti.App.addEventListener("alert", function(){
    Ti.API.info("fireEvent from webview - alert");
    alert("Alert was Clicked.");
});

win.add(webview);
win.open();

webview.html:

<html>
<body>
<button onClick="Ti.App.fireEvent('alert');">Click me to fire an alert</button>
<button onClick="Ti.App.fireEvent('reload');">Click me to reload webview</button>
</body>
</html>

Comments

  1. Don Thorp 2011-04-15

    Note: the url case should be supported. Not sure it's worth trying to keep an unmodified version of the html source around.

  2. sourabh kaley 2013-03-19

    Neither reload() works nor repaint() on iPhone?
  3. Alan Hutton 2020-01-09

    It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.

JSON Source