Detect browser support for cross-domain XMLHttpRequests?

前端 未结 4 995
北荒
北荒 2020-12-08 02:13

I\'m working on some Javascript that makes use of Firefox 3.5\'s ability to perform cross-domain XMLHttpRequests… But I\'d like to fail gracefully if they aren\'t supported.

4条回答
  •  时光取名叫无心
    2020-12-08 02:59

    You might want to look at EasyXDM, which wraps cross-browser quirks and provides an easy-to-use API for communicating in client script between different domains using the best available mechanism for that browser (e.g. postMessage if available, other mechanisms if not).

    Clearly that library has solved the browser-capabilities detection problem, so you can benefit from their experience. :-)

提交回复
热议问题