2016-12-16 45 views
0

我想在網站上顯示帶有其邊框的「德國」地圖。 使用Windows 10和Firefox的一切工作正常,但在Mac OS和iPhone的layer.vector不顯示。有任何想法嗎?OpenLayers layer.vector未在Mac和iPhone上顯示

<script> 
    var fill = new ol.style.Fill({ 
    color: 'rgba(30,144,255,0.2)' 
    }); 

    var stroke = new ol.style.Stroke({ 
    color: '#1E90FF', 
    width: 2 
    }); 

    var style = new ol.style.Style({ 
    fill: fill, 
    stroke: stroke 
    }); 

    var vectorLayer = new ol.layer.Vector({ 
    source: new ol.source.Vector({ 
     url: '[URL TO JSON]', 
     format: new ol.format.GeoJSON() 
     }), 
    style: style 
    }); 

    var map = new ol.Map({ 
    layers: [ 
     new ol.layer.Tile({ 
      source: new ol.source.OSM() 
     }), 
     vectorLayer 

    ], 
    target: 'map', 
    view: new ol.View({ 
     center: ol.proj.fromLonLat([5.9688, 51.0852]), 
     zoom: 5 
    }) 
    }); 

頂部:窗10 +火狐

底部:MAC OS +火狐/ Safari瀏覽器

enter image description here

+0

不知道?沒有人? :/ – Lukas

+0

在Mac上使用Safari時,Web瀏覽器中的控制檯說什麼?我的猜測是,您遇到了其他瀏覽器可以使用的錯誤。 – GoinOff

回答

0

忘了這個問題。是我的錯。我在Window 10 PC上使用XAMPP在本地運行。該URL類似於localhost/...。是的,這導致了問題,我是盲目的,並沒有看到它2天:D