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

Windows: WebView local script doesn't work for hyperlink

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 5.4.0
    • Fix Version/s: Release 6.0.0
    • Component/s: Windows
    • Labels:
      None
    • Story Points:
      5
    • Sprint:
      2016 Sprint 12 SDK

      Description

      WebView local script does work for the first page, but it doesn't work on the next page where you follow its hyperlink.

      Resources/app.js

      var win = Ti.UI.createWindow();
      var view = Ti.UI.createView({backgroundColor:'blue'});
      var webview = Ti.UI.createWebView({
          url: 'WebViewTestPage.htm',
          height: '80%',
          width: Ti.UI.FILL,
          bottom: 0
      });
      var button = Ti.UI.createButton({
          title: 'fromTitanium',
          height: '10%',
          width: Ti.UI.FILL,
          top: 0, left: 0
      });
      button.addEventListener('click', function (e) {
          Ti.App.fireEvent('app:fromTitanium', { message: 'event fired from Titanium, handled in WebView' });
      });
      Ti.App.addEventListener('app:fromWebView', function (e) {
          alert(e.message);
      });
       
      view.add(webview);
      view.add(button);
      win.add(view);
      win.open();
      

      Resources/WebViewTestPage.htm

      <html>
      <head>
          <script>
              Ti.App.addEventListener("app:fromTitanium", function(e) {
                  Ti.API.info(e.message);
              });
          </script>
      </head>
      <body>
          <h2><a href="ms-appx-web:///NextPage.htm">Follow this link and see if script works</a></h2>
          <button onclick="Ti.App.fireEvent('app:fromWebView', { message: 'event fired from WebView, handled in Titanium' });">fromWebView</button>
      </body>
      </html>
      

      Resources/NextPage.htm

      <html>
      <head>
          <script>
              Ti.App.addEventListener("app:fromTitanium", function(e) {
                  Ti.API.info(e.message);
              });
          </script>
      </head>
      <body>
          <h2>NextPage.htm</h2>
          <button onclick="Ti.App.fireEvent('app:fromWebView', { message: 'event fired from WebView, handled in Titanium' });">fromWebView</button>
      </body>
      </html>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kiguchi Kota Iguchi
                Reporter:
                kiguchi Kota Iguchi
                Reviewer:
                Christopher Williams
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code