Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ie + file:/// = "Access denied" #357

Closed
kbabintsev opened this issue Aug 23, 2011 · 11 comments
Closed

ie + file:/// = "Access denied" #357

kbabintsev opened this issue Aug 23, 2011 · 11 comments

Comments

@kbabintsev
Copy link

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>less</title>
        <link rel="stylesheet/less" type="text/css" href="main.less">
        <script type="text/javascript" src="less-1.1.4.js">
        </script>
    </head>
    <body>
    </body>
</html>
body
{
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: red;
}

Error "Access denied" when trying to open html using file protocol (file:///C:/Projects/index.html).
It's work fine with ActiveXObject implemetation of XMLHttpRequest.

function getXMLHttpRequest() {
    if (window.XMLHttpRequest 
       // This is solution?
       && !(window.ActiveXObject && isFileProtocol)
    ) {
        return new(XMLHttpRequest);
    } else {
        try {
            return new(ActiveXObject)("MSXML2.XMLHTTP.3.0");
        } catch (e) {
            log("browser doesn't support AJAX.");
            return null;
        }
    }
}
@ttfkam
Copy link
Contributor

ttfkam commented Aug 23, 2011

@bertBruynooghe
Copy link

I also would like this issue to be resolved as it would enable our developpers/designers to edit less files and see the reuslts without having to run a webserver.

@ttfkam
Copy link
Contributor

ttfkam commented Oct 18, 2011

Unfortunately, this issue cannot be resolved by Less. Web browsers have very strict rules about arbitrary requests to the local filesystem -- for good reason. That said, Macs come preconfigured with a web server, Linux & BSD web servers are extremely easy to install, and both nginx and apache have Windows installers. On my Windows machine, I run nginx; very low memory and just a double-click of an icon to start it.

@kbabintsev
Copy link
Author

Not good news. We creating offline (local) application that uses file protocol and all major js libs works... jQuery for example with AJAX requests to local resources (files)...

@ttfkam
Copy link
Contributor

ttfkam commented Oct 20, 2011

@kbabintsev my apologies, I misspoke. Assuming this is the IE7/8 issue I think it is, it could be resolved in Less. I was completely mistaken with regard to local resources. Again, sorry.

@imeleshkov
Copy link

I'd like to get this issue fixed too.

@lukeapage
Copy link
Member

anyone like to suggest what that fix is?

@Synchro
Copy link
Member

Synchro commented Sep 3, 2012

The fix suggested in this answer looks workable, but would increase the overall number of requests in IE (though that's its fault for being broken!). To integrate it we'd need to rewrite the xhr function to work this way.

@Scorpin
Copy link

Scorpin commented Oct 12, 2013

Hi, I had the same problem and I sent you another way to fix it: Scorpin@ee2c1a1

Greetings.

@matthew-dean
Copy link
Member

According to the attached Stack Overflow links, this was only an issue in IE7 / IE8. Should probably consider closing by now.

@seven-phases-max
Copy link
Member

Closing as not applicable anymore (let MS care of their ancient stuff on their own).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants