2

Someone must have the answer to this, it's driving me nuts!!!

I am testing a jquery mobile page and have the following in my index.html page:

<link rel="stylesheet" href="css/jquery.mobile-1.2.0.min.css" />
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery.mobile-1.2.0.min.js"></script>

It doesn't work. The page doesn't recognize the css or js. But when I load it over the network it works:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

I've copied and downloaded those files over and over to check that I have the right local files. Why would it load from an external URL but not my local files?

8
  • 2
    Do you have a subfolder 'js' and subfolder 'css' relative to the folder where index.html is? Commented Dec 20, 2012 at 21:29
  • Can you point to the live files for us? Commented Dec 20, 2012 at 21:29
  • it is probably because you are not referring the correct url try starting with '/' which means start from the domain and give your path according to your domain. Commented Dec 20, 2012 at 21:30
  • this question is a dup of stackoverflow.com/questions/7199975/… Commented Dec 20, 2012 at 21:30
  • Yes, I have js and css subfolders relative to the index.html folder. The live files are in the place where the links are above. I know hte index.html is working it just doesn't find the css. Commented Dec 20, 2012 at 21:31

1 Answer 1

1

If you have a js folder and a css folder in the root of your project add a leading "/". The leading slash will start you at the beginning of the domain.

<link rel="stylesheet" href="/css/jquery.mobile-1.2.0.min.css" />
<script src="/js/jquery-1.8.2.min.js"></script>
<script src="/js/jquery.mobile-1.2.0.min.js"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

still no luck. Adding the leading "/" didn't seem to make any difference.
I finally found the answer in another post. When installing these css files locally, there are image files that need to be installed with them. And they need to be in a subfolder in the CSS folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.