IE8 and the new vw unit. Good polyfill?

3.3k Views Asked by At

Im testing out the vw unit (relative to viewport width). My question is, is there an easy method to convert the vw value with pixels? It doesnt have to be responsive. I was thinking of Jquery. The prefixfree plugin and vminpoly dont seem to work for me (testing on locally)

1

There are 1 best solutions below

1
On

I tested the following vminpoly demo link on IE8, and it worked: http://saabi.github.io/vminpoly/demo2.html

It's important to note that using many CSS-related polyfills require that you are running them from a real web server (even if locally), as the basis off which they work is to "AJAX load" the CSS file's raw text and parse it manually. If IE8 doesn't support viewport units, the JS polyfill will never know its value by simply parsing the DOM with jQuery or whatever.

You say you're testing locally. Is that from a local server instance (http://localhost) or directly from the file system (file:///index.html)? The latter is very likely to fail due to cross domain security policy restrictions (XHR).

You can read more about this for the RespondJS polyfill.