Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10397] Android: Ti namespace does not work in webview after reload

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-14T08:07:02.000+0000
Affected Version/sRelease 2.1.1
Fix Version/sRelease 3.0.0, Sprint 2012-19 Core, 2012 Sprint 19
ComponentsAndroid
Labelscore, module_webview, qe-review, qe-testadded
ReporterAnirudh Nagesh
AssigneeAllen Yeung
Created2012-08-10T12:39:35.000+0000
Updated2019-07-18T10:57:27.000+0000

Description

Run the attached app.js and sample test.html file. The Ti namespace does not work after webview reload. works fine on ios.

Attachments

FileDateSize
app.js2012-08-10T12:39:35.000+0000845
test.html2012-08-10T12:39:35.000+000098

Comments

  1. Allen Yeung 2012-09-13

    More detailed testing instructions:
       var window = Ti.UI.createWindow({
       	layout : "vertical"
       });
       
       var webview = Ti.UI.createWebView({
       	top : 0,
       	width : '100%',
       	height : 100
       });
       
       var loadButton = Ti.UI.createButton({
       	title : "load html",
       	top : 50,
       	width : 200,
       	height : 50
       });
       
       var logButton = Ti.UI.createButton({
       	title : "Log Message",
       	top : 50,
       	width : 200,
       	height : 50
       });
       
       var reloadButton = Ti.UI.createButton({
       	title : "reload webview",
       	top : 50,
       	width : 200,
       	height : 50
       });
       
       var remoteButton = Ti.UI.createButton({
       	title : "remote load webview",
       	top : 50,
       	width : 200,
       	height : 50
       });
       
       remoteButton.addEventListener("click", function() {
       	webview.url = "http://www.google.com";
       
       });
       
       loadButton.addEventListener("click", function() {
       	webview.url = "test.html";
       
       });
       
       logButton.addEventListener("click", function() {
       	webview.evalJS("Ti.API.info(\"-------------------------------hello\")");
       
       });
       
       reloadButton.addEventListener("click", function() {
       	webview.reload();
       });
       
       window.add(webview);
       window.add(remoteButton);
       window.add(loadButton);
       window.add(logButton);
       window.add(reloadButton);
       
       window.open();
       
    1. Add the app.js above (NOT the one attached to this ticket), and also add the 'test.html' attached. Both should be under the Resources directory. 2. Run the app and click on load html ('test0' should load in the webview) 3. Click on Log Message, and confirm that the hello message appears in logcat 4. Click on reload webview 5. Click on Log Message and confirm that the hello message appears in logcat Actual Results: The hello message does not appear after the reload Actual Results: The hello message appears after the reload NOTE: I have also added a 'remote load webview' button, which will load a remote URL. Clicking log message after loading a remote webview SHOULD NOT display the hello message. This is because we do not inject Titanium APIs for remote webviews.
  2. Satyam Sekhri 2012-10-25

    Verified On: Titanium Studio: 3.0.0.201210220122 Titanium SDK: 3.0.0.v20121024144610 Android Device: Galaxy Duos(v2.3.6), Galaxy Tab(v3.2), Galaxy Nexus(v4.0.4)

JSON Source