Docs without a Server don't work (Chrome) #3113

eddiemonge opened this Issue Nov 19, 2011 · 14 comments


None yet

3 participants


clicking the links gives an AJAX error unless opened on a web server


Running this flag allows Chrome on Mac to open local files:
/Applications/Google\\ Chrome --allow-file-access-from-files

This will allow most requests to work. Some don't work because they are trying to rewrite file:/// with file://

XMLHttpRequest cannot load file:///Users/eddie/Desktop/ Origin file:// is not allowed by Access-Control-Allow-Origin.


I think this may be a hard constraint with AJAX, but if we can figure out a workaround, that is ideal. If not, we have a few options:

  • add a readme in the docs root explaining that a server is needed, cons: might be missed

  • throw up an alert message explaining that links won't work unless it's viewed on a server. cons: how to detect when to show this, maybe just change the docs AJAX error message popup to show a custom message?

  • turn off AJAX within the docs. cons: would kill transitions so it wouldn't show off the docs too well

  • remove the docs zip


Maybe a short term-fix is to add a message to the docs homepage saying that a web server is required and link to a wiki page here with instructions.


So is this only a Chrome issue? I just tried FF and it works. Do you know if IE will open these AJAX links?


Eddie - if you can conditionally write in some html to the docs homepage, we could inject this block above the footer (feel free to edit)

    <div data-role="footer" class="footer-docs" data-theme="e">
            <h3 style="text-align:left; margin-bottom:-8px;">Note: Navigation may not work if viewed locally</h3>
            <p>The AJAX-based navigation used throughout the jQuery Mobile docs may need to be viewed on a web server to work in certain browsers such as Chrome. If you see an error message when you click a link, try a different browser or <a href="">view help</a>.</p>

You mean add it to the docs? Like check to see if the protocol is file:// and if so, display the message?


I've tested a bit around with server-less docs reading.
The page-not-found-home-button issue is known, but there are some other links that link to directories and build on the webservers DirectoryIndex response. For example nearly all links at forms elements page.

Tested browsers:
IE 7 WinXP: css hurts but it works
IE 8 Win7: works
Chrome 15.0 Win: as known just with --allow-file-access...
FF 8.0 Win: does not work I get no log in firebug, just a page not found with every link
Safari 5.0.5 Win: works (info: unc-path to a server-dir does not work at all, mapped drive letter needed)
Safari 5.1.1 OS X: works


Somewhat fixed in #3117
I disabled ajax browsing for non-webservers


only thing about that fix is that I think Phonegap use file:// for its webviews. Does anyone know this off-hand?


MauriceG - thanks for the research. So I'm leaning towards leaving AJAX enabled, but adding a brief message explaining that this might not work unless viewed on a web server and have a link to a wiki page with info on where this works and how to set up the server.

Maybe a happy medium would be to add the message above and offer a link to browse docs with AJAX off? Think we'd need to set a cookie to trigger that script from page to page.


@johnbender didnt we resolve this?


Yep, this issue can be closed. Thanks Eddie.

@toddparker toddparker closed this Dec 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment