Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using post #32

Open
leonardliau opened this issue Nov 24, 2015 · 5 comments
Open

Error using post #32

leonardliau opened this issue Nov 24, 2015 · 5 comments

Comments

@leonardliau
Copy link

Hi,
I get error when using post.
The error message in console.log "Refused to set unsafe header 'Contect-length' and 'Connection'".

Please help.

Thank you

@leonardliau
Copy link
Author

Hi,
I remove //request.setRequestHeader("Content-length", data.length);
//request.setRequestHeader("Connection", "close");

But after I submit post nothing happen. And I check my facebook timeline nothing show up

Any advise ?

Thanks

@caiovaccaro
Copy link
Owner

Hi there!

Can you please share all your code in a code block or pastebin? And also which OS and phone are you testing?

Thanks,

@leonardliau
Copy link
Author

Hi,

// Settings FacebookInAppBrowser.settings.appId = 'xxxxxxxx'; FacebookInAppBrowser.settings.redirectUrl = 'http://myweb.com/'; FacebookInAppBrowser.settings.permissions = 'public_profile,email,user_friends';
  // Optional
  FacebookInAppBrowser.settings.timeoutDuration = 7500;

  // Login(accessToken will be stored trough localStorage in 'accessToken');
  FacebookInAppBrowser.login({
      send: function() {
          //console.log('login opened');
      },
      success: function(access_token) {
          //console.log('done, access token: ' + access_token);
      },
      denied: function() {
          //console.log('user denied');
          angular.element(document.querySelector('#share-button')).removeAttr('disabled');
          $ionicLoading.hide();
      },
      timeout: function(){
          alert('a timeout has occurred, probably a bad internet connection');
          angular.element(document.querySelector('#share-button')).removeAttr('disabled');
          $ionicLoading.hide();
      },
      complete: function(access_token) {
          //console.log('window closed');
          if(access_token) {
              //console.log(access_token);
          } else {
              //console.log('no access token');
          }
          angular.element(document.querySelector('#share-button')).removeAttr('disabled');
          $ionicLoading.hide();
      },
      userInfo: function(userInfo) {
          if(userInfo) {
              //alert(JSON.stringify(userInfo));
              var fbid = userInfo.id;
              // Share urls
              FacebookInAppBrowser.post({
              name: 'My post',
              link: 'http://frop.me',
              message: 'Try this out',
              picture: 'http://caiovaccaro.com.br/wp-content/uploads/2013/10/frop01.jpg',
              description: 'Sent trough mobile app'}, function(response) {
                  if(response) {
                      console.log('post successful');
                  }
              });
          } else {
              //console.log('no user info');
          }
      }
  });

The error message in console.log "Refused to set unsafe header 'Contect-length' and 'Connection'".

Any advice?

Thanks

@dineshluck1
Copy link

I am also facing same issue while using "FacebookInAppBrowser.post" method

"Refused to set unsafe header "Content-length"", source: file:///android_asset/www/js/phonegap.facebook.inappbrowser.js (81)

"Refused to set unsafe header "Connection"", source: file:///android_asset/www/js/phonegap.facebook.inappbrowser.js (82)

If anyone have solution,please share it.

@caiovaccaro
Copy link
Owner

Hi @dineshluck1 , are you using/testing this on the device?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants