Opened 3 months ago

Closed 2 months ago

#2163 closed defect (fixed)

openlayers_quickstart fails

Reported by: darkblueb Owned by: osgeolive@…
Priority: normal Milestone: OSGeoLive13.0
Component: OSGeoLive Keywords: openlayers
Cc:

Description

The script from “http://localhost/openlayers/dist/ol-debug.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.

Loading failed for the <script> with source “http://localhost/openlayers/dist/ol-debug.js”.

after creating basic-map example file

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Basic map</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">

        <!-- OpenLayers CSS -->
        <link rel="stylesheet" href="http://localhost/openlayers/dist/ol.css" type="text/css">

        <!-- Custom styles -->
        <style>
          #map {
            width: 100%;
            height: 500px;
          }
        </style>
    </head>
    <body>
        <h1>Basic map</h1>

        <div id="map"></div>

        <!-- OpenLayers JS-->
        <script src="http://localhost/openlayers/dist/ol-debug.js" type="text/javascript"></script>

        <!-- App code -->
        <script>
          var map = new ol.Map({
            target: 'map',
            layers: [
              new ol.layer.Tile({
                source: new ol.source.OSM()
              })
            ],
            view: new ol.View({
              center: ol.proj.fromLonLat([2.1833, 41.3833]),
              zoom: 6
            })
          });
        </script>

    </body>
</html>


Change history (3)

comment:1 Changed 2 months ago by kalxas

This is the fix needed in the quickstart:

<!-- OpenLayers JS-->
        <script src="http://localhost/openlayers/dist/ol.js" type="text/javascript"></script>

comment:3 Changed 2 months ago by kalxas

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.