使用 openlayers3 js 库时 jsbin 编辑器出现问题

issue with jsbin editor while using openlayers3 js library

我正在学习 OpenLayers 3,我 运行 在尝试使用 JS Bin 在线编辑器将底图拉入浏览器时遇到了问题。

如果我在本地文本编辑器 (Notepad++) 中编写完全相同的代码,一切都会正常运行。但是当我使用 JS Bin 时不是。

这是 link 代码:

https://jsbin.com/wijoha/edit?html,css,console,output

你能帮我找出问题所在吗?我已经花了几个小时试图解决这个问题,但无法解决它...

查看您添加的 JSBin 的控制台(浏览器 window 的控制台,而不是 JSBin 的控制台),CSS 未在您尝试放置时加载将 HTTP 资源转换为 HTTPS 页面。错误消息如下:

Mixed Content: The page at 'https://null.jsbin.com/runner' was loaded over HTTPS, but requested an insecure stylesheet 'http://openlayers.org/en/v3.10.1/css/ol.css'. This request has been blocked; the content must be served over HTTPS.

此外,您的 JS 文件 ol.js 根本没有加载,因为 openlayers.org 似乎不接受通过 HTTPS 提供文件(至少对我来说,在 Chrome ).

相反,尝试通过 HTTP 服务所有内容(包括 JSBin 本身的 URL),这是一个工作示例:

http://jsbin.com/focoxoxabo/edit?html,css,console,output