I use Facebook JavaScript SDK in Metro Mode of Windows 8 with JavaScript based application.
First, I use iframe to load facebook.html file in default.html with
<iframe id="facebookIframe" src="ms-wwa-web:///facebook.html"></iframe>
and add
<script src="http://connect.facebook.net/en_US/all.js"></script>
in facebook.html file.
(According to Load remote .js file into app )
When application running, JavaScript Console said
* Windows Web Applications supports a limited set of ActiveX controls.
* JavaScript runtime error: Unable to get value of the property 'length': object is null or undefined. File: http://connect.facebook.net/en_US/all.js, line: 7 column: 1313
Then I download all.js from Facebook and add it into Visual Studio project.
Load it by
<script src="/js/all.js"></script>
And modify the part of error occur in all.js from
if(navigator.mimeTypes.length>0)
to
if(navigator.mimeTypes && navigator.mimeTypes.length>0)
And it seems to work…
Is it a bug of Facebook JavaScript SDK?
Thanks for replying in advance.
Sars
It looks more like a bug in the Metro SDK… if they want client scripts to have a decent chance at working, navigator.mimeTypes should return an empty collection (like it does in IE10) instead of undefined.