问题
I have a problem with making filepicker.io work with IE versions other than the latest 10. Other browsers work fine.
I am attaching a simple code sample (the jQuery ready part is me trying to make it work). On IE8 and IE9, the "Pick File" button just does not show. A blank text input is shown instead.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js"></script>
<script>
$(document).ready(function () {
filepicker.setKey('mykeygoeshere');
});
</script>
<body>
<input type="filepicker" />
<script src="//api.filepicker.io/v1/filepicker.js"></script>
</body>
At the same time, this https://developers.filepicker.io/docs/web/#widgets-pick works. What am I missing here?
UPDATE:
I forgot to mention, that IE9 that we were testing on raised
SCRIPT5009: 'JSON' is undefined
and we had to add
<script src="//cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js"></script>
to the code. Code above updated.
When we go to the debugger, it does not show any more errors. Moreover, the Network profiler shows, that filepicker initializes itself and pulls:
https://www.filepicker.io/dialog/comm_iframe/ GET 200 text/html 1,02 KB 171 ms appendChild <frame>
回答1:
The answer was simple, only the place to look for it required a little bit of an out-of-the-box approach.
We played with different compatibility modes, and it turned out, that IE chose this particular rendering mode:
<meta http-equiv="X-UA-Compatible" content="IE=5" />
Not that the example file had any meta tags... but it started working, when content was set to any of IE=8, IE=9 (not surprisingly), as in http://blogs.msdn.com/b/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx
Hope this will help someone. Case closed.
来源:https://stackoverflow.com/questions/14991919/filepicker-io-works-in-ie10-not-in-ie9-or-ie8