How to make respond.js work without a web server

2.1k views Asked by At

I'm using a variation of respond.js on a website. I need it for the likes of IE6-IE8. Here's the source code. http://kl1p.com/HGv/2

I didn't have any trouble with it when I was running it on my web server. The problem is, for this project I have my hands tied and I cannot use a web server of any sort (long story).

Is there any way to make this code work WITHOUT a web server? I realise this:

Due to security restrictions, some browsers may not allow this script to work on 
file:// urls (because it uses xmlHttpRequest). Run it on a web server.

is an implication of why it wouldn't be working. Is there any other way to get this to work?

One thing I did notice is that it works in chrome without a server. Definitely not in IE8 though.

This might be an impossible task, but it's worth asking at least anyway.

2

There are 2 answers

0
Giancarlo Colfer On

@Bergi,

Yes there is a non-minified version of the code available at github.com/scottjehl/Respond.

The file is called respond.src.js.


Adding on,

Anyone needing a server environment to program should give XAMPP - portableapps.com/apps/development/xampp a try, it is a complete, portable server.

XAMPP is an integrated server package of Apache, mySQL, PHP and Perl (the AMPP in XAMPP) that all run from a removable drive. Everything is pre-configured and ready to go just by unzipping or installing it.


And last but not least, there seems to be a bug when using both respond.js / respond.proxy.js when linking to a css file with a relative url. To fix it, use an absolute url (protocol included).

Do not do this:

 <link rel="stylesheet" href="//www.yourdomainname.com/style.css">

Do this:

<link rel="stylesheet" href="http://www.yourdomainname.com/style.css">

Taken from: cross domain - Respond.js on Subdomain using Tumblr

0
fitzilla On

I've come to a compromise. I'm using the 'Cross Domain Patch' method as included here https://github.com/scottjehl/Respond