Respond.js with external css resources

2019-08-06 02:59发布

问题:

To optimize our webpages to IE8 we need to add MediaQueryes with respond.js (or other simular solution). But it seems that respond.js (and many simular solutions) require local css files.

For example we liked to use the cdn-css for leafletjs, but this will not correct by IE8.

Any ideas of how to do this?

回答1:

Respond.js actually works if you set up a provide a proxy page for it to reference.

See https://github.com/scottjehl/Respond#cdnx-domain-setup and check out the cross-domain example at https://github.com/scottjehl/Respond/tree/master/cross-domain

<!-- Respond.js proxy on external server -->
<link href="http://externalcdn.com/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />

<!-- Respond.js redirect location on local server -->
<link href="/path/to/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />

<!-- Respond.js proxy script on local server -->
<script src="/path/to/respond.proxy.js"></script>