Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript and jQuery not secure over https

I am building an ASP.NET MVC 3 app which will run in Azure. Everything was working well, until I switched to https. Now most of my jQuery plugins and some other javascript are not secure.

I'm using the Datatables library as well as jsTree, Watermaks and Breadcrumbs. Most of this script is to make our site look appealing.

Is there a way to make this secure? Or is it time to move a very lean javascript site?

Thank you for the help!

like image 287
James Avatar asked Feb 01 '12 19:02

James


2 Answers

The jQuery site itself does not support https:// as a host. My suggestion is to download the latest version and host it yourself with a relative path (eg. /js/jquery.js) so it will match your protocol. As a side note, removing the protocol from the beginning of an absolute path will match the protocol that the user is browsing in. Like so:

<script src="//www.google.com/someresource.js"></script>

will link to either http or https depending on the current url the user is browsing.

like image 120
Kyle Macey Avatar answered Sep 28 '22 16:09

Kyle Macey


Just load your scripts via https instead of http ... seems obvious enough.

If you are loading them from a CDN, check if said cdn has a https option, if not, you'll need to serve them yourself through the same https protocol you are using for the rest of your site.

like image 28
jondavidjohn Avatar answered Sep 28 '22 16:09

jondavidjohn