3

Hi im currently developing HTML5+Cordova app that is using Facebook Javascript SDK using Intel XDK.

I develop the index.html and host this in a local server like: http://localhost:9090/app/index.html

When i test the index.html in browser (firefox) (not in Intel XDK emulator), login, get user info, and logout process works fine.

But when i test the same hosted index.html in Intel XDK Emulator, after setting the webview's location

window.location.href='http://localhost:9090/app/index.html

When the page is loading, i saw in the log security errors about iframe:

Uncaught SecurityError: Failed to set the 'domain' property on 'Document': Assignment is forbidden for sandboxed iframes.

that comes from javascript in url like this:

http://static.ak.facebook.com/connect/xd_arbiter/y5GDQHcTQFZ.js?version=41#channel=f1dfa884ce2b6c4&origin=http%3A%2F%2Flocalhost%3A9090

When i inspect the HTML element, the javascript is from iframes generated by facebook sdk within div element (fb-root).

Also, when i do a FB login (via a button click), one of these things can happen:

  • FB login page just shows a blank white page
  • FB login page shows, enter user and password, but when the dialog's login button clicked, the page turns to a blank white page, (seems the login dialog not closing ??).

These also have error in the console:

Uncaught SecurityError: Failed to set the 'domain' property on 'Document': Assignment is forbidden for sandboxed iframes.

coming from this javascript:

https://m.facebook.com/v2.4/dialog/oauth?app_id=xxx&client_id=xxx&display=touch&domain=localhost...

My question is, facebook Javascript SDK uses iframes to do its operation, but why does in the browser the operation works well, but when executed in the device emulator, the webview says security error ?

Why do this happens ?

Whats the solution to make the FB JS SDK works in the webview ?

Do I have to configure the device's webview's browser configuration ?

Or are there another solutions ?

Thanks.

0 Answers0