Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

javascript - How to deal with net::ERR_SSL_PROTOCOL_ERROR?

I am including a JS library into my website

<script type="text/javascript" src="http://www.turnjs.com/lib/turn.min.js "></script> 

that is designed, maintained and hosted by a webdesign company. The implementation of what I am trying to achieve seems to be well coded – see my JSFiddle – it works fine with no errors. However when a copy and paste the code from my JSfiddle into my website, it doesn’t work at all – Google Chrome developer console shows this:

GET https://www.turnjs.com/lib/turn.min.js net::ERR_SSL_PROTOCOL_ERROR

But it is weird, since my Jsfiddle code is including the same turn.min.js and it works there, but on my website it doesn’t.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is not a javascript problem, it's an ssl probem.

You can't get a file through an insecure connection (http) from a html page served through a secure connection (https). If you're going to use https (and you SHOULD!) then you need to get the script through a secure connection. To get the file, you should use:

<script type="text/javascript" src="https://www.turnjs.com/lib/turn.min.js "></script> 

And make sure that the file is being served through https, by configuring the server accordingly. Here's a simple configuration for lighttpd, and here's one for apache. If you don't have a CA signed certificate, you could get one with letsencrypt ( www.letsencrypt.org/getting-started/ ). If you don't control the server, you should get in contact with the person who does.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...