Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-3501

webview reload() does not reload `url` or `html `properties

    Details

      Description

      {html}<div><p>Testing using:</p>
      <ul>
      <li>Titanium Mobile SDK 1.6.1(15 Mar 2011)</li>
      <li>Android emulator 2.2</li>
      </ul>
      <p>The following code demonstrates that webview.reload() does not
      reload the <code>url</code> or <code>html</code> 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 <code>url</code> or <code>html</code> properties are
      reassigned:</p>
      <p><strong>app.js:</strong></p>
      <pre>
      <code>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();</code>
      </pre>
      <p><strong>webview.html:</strong></p>
      <pre>
      <code><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></code>
      </pre></div>{html}

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              pdowsett Paul Dowsett
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-2999
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration