简体   繁体   中英

How to load JavaScript files using HTTPS (and not HTTP) require.js?

I'm working with a project that uses require.js to load javascript files and dependencies of it. All of the javascripts was all working fine when we are using HTTP but after we convert to HTTPS it does not load properly and I got an error. I am very new to require.js. Thanks for helping me in advance.

This is the error:

[blocked] The page at 'https://ourdomainhere.com' was loaded over HTTPS, but ran insecure content from 'http://cdn.jsdelivr.net/webjars/angularjs/1.3.4/angular.min.js': this content should also be loaded over HTTPS.

loading a javascript file

requirejs.config({

  paths: {
    //how can I make this to call https and not http?
    'angular': '../lib/angularjs/angular'    
  }

});

My question is how can I make require.js call https and not http for loading javascript files? Does the problem is with require.js or in our SSL cert?

Main problem is that you load your angular from HTTP site http://cdn.jsdelivr.net . You have to load https://cdn.jsdelivr.net You can use and https://cdn.jsdelivr.net/webjars/angularjs/1.3.4/angular.min instead of googleapis.

requirejs.config({

  paths: {
    'angular': 'https://ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.min'    
  }

});

Can you try it?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM