Question

I'm trying to use an example jquery-mobile page as below:

<!DOCTYPE html> 
<html> 
<head> 
    <title>My Page</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <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>
</head> 
<body> 

<div data-role="page">

    <div data-role="header">
        <h1>My Title</h1>
    </div><!-- /header -->

    <div data-role="content">   
        <p>Hello world</p>      
    </div><!-- /content -->

</div><!-- /page -->

</body>
</html>

while hosting this file in my Dropbox public folder as ~/Dropbox/Public/index.html.

When I try to access the file locally (e.g. file:///home/<USER>/Dropbox/Public/index.html) everything works alright.

When I try to access the file using the public link (e.g. https://dl.dropboxusercontent.com/u/<DROPBOX_ID>/index.html) it doesn't pull jquery files and the page is not displayed properly. This problem is not specific to jquery and exists in any other CDN as well.

I can download the files to my local machine and host them in Dropbox (e.g. file:///home/<USER>/Dropbox/Public/js/) and it works as expected but I would like to use CDNs for not wasting Dropbox bandwidth and also for being able to easily upgrade library versions.

Is there a way to fix this?

Was it helpful?

Solution

Your browser is probably refusing to load non secure content (jquery) into a page served from a secure location (your dropbox hosted page)

Change the jquery link to use https and you should be ok (alternatively use a procotol relative link (//code.jquery.com) and the browser will pick http or https as appropriate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top