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

iOS: WebView - load a webpage with request headers

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 6.1.0
    • Fix Version/s: Release 6.1.0
    • Component/s: iOS
    • Labels:
    • Environment:
    • Story Points:
      5
    • Sprint:
      2017 Sprint 04 SDK

      Description

      Problem
      Opening a webpage like https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending with request headers does not work.

      actual behavior

      1. click on 'open web page'
      2. in the log is shown

        [INFO] :   beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending
        [INFO] :   beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending
        [INFO] :   load: about:blank
        [INFO] :   beforeload: about:blank
        [INFO] :   beforeload: about:blank
        [INFO] :   beforeload: about:blank
        [INFO] :   beforeload: about:blank
        

      3. webpage is not loaded

      expected behavior

      1. click on 'open web page'
      2. in the log is shown

        [INFO] :   beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending
        [INFO] :   beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending
        [INFO] :   load: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending
        

      3. webpage is loaded

      Test case
      file index.js

      var win = Ti.UI.createWindow({
          backgroundColor : 'white'
      });
       
      var openButton = Ti.UI.createButton({
          title : 'Open web page',
          top : '200',
          height : Ti.UI.SIZE,
          left : '30',
      });
       
      openButton.addEventListener('click', function() {
       
          var ldf = Ti.Platform.displayCaps.logicalDensityFactor;
          var webView = Ti.UI.createWebView({
              height : Math.floor(Ti.Platform.displayCaps.platformHeight / ldf),
              width : Math.floor(Ti.Platform.displayCaps.platformWidth / ldf),
              backgroundColor : "white",
          });
       
          webView.setBasicAuthentication("username", "password");
          var requestHeaders = {
              "Accept-Language" : "en",
              "X-Agent" : "Mobile"
          };
          webView.setRequestHeaders(requestHeaders);
       
          webView.addEventListener('load', function() {
              Ti.API.info('load: ' + webView.url);
          });
       
          webView.addEventListener('beforeload', function() {
              Ti.API.info('beforeload: ' + webView.url);
          });
       
          webView.addEventListener('error', function() {
              Ti.API.info('error: ' + webView.url);
          });
       
          win.add(webView);
       
          var button = Ti.UI.createButton({
              title : 'Close',
              top : 25,
              bottom : 0,
              height : Ti.UI.SIZE,
              width : 100
          });
       
          button.addEventListener('click', function() {
              win.remove(webView);
          });
       
          webView.add(button);
          var url = "https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending";
          webView.setUrl(url);
      });
       
      win.add(openButton);
       
      win.open(); 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                chris35 Christoph Eck
                Reviewer:
                Hans Knöchel
                Tester:
                Josh Longton
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration