openlayers 5.1.3:快速启动示例中的“损坏”缩小按钮?

-3 openlayers

我尝试从谷歌地图切换到 osm 并尝试了 OpenLayers(快速入门示例)。如果我使用托管构建,一切看起来都不错。但是,如果我下载 5.1.3 软件包并将其托管在我们的网络服务器上,则缩小按钮的标题会损坏。URL:http : //www.canalcup-cam.de/maps.php
看起来好像使用了非 ASCII“-”...我试图找到设置按钮标题的代码,但没有成功。网站的编码与此有关吗?我试过 utf-8 和 Windows-1250。

问候, hjt

Mik*_*ike 5

当我复制您的代码并链接到您的 ol.js 副本时,我需要插入<meta charset="utf-8">减号(它是 html&minus;而不是连字符)以正确显示:

  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/css/ol.css" type="text/css">
    <style>
      .map {
        height: 400px;
        width: 100%;
      }
    </style>
    <script src="http://www.canalcup-cam.de/inc/OpenLayers/v5.1.3/build/ol.js"></script>

    <title>OpenLayers example</title>
  </head>
Run Code Online (Sandbox Code Playgroud)

但是使用 ol.js 的 cdn 版本它可以在没有元标记的情况下工作。也许您的副本以某种方式被更改,但始终包含元标记仍然是一个好习惯。

  <head>
    <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/css/ol.css" type="text/css">
    <style>
      .map {
        height: 400px;
        width: 100%;
      }
    </style>
    <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/build/ol.js"></script>

    <title>OpenLayers example</title>
  </head>
Run Code Online (Sandbox Code Playgroud)