Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SyntaxError: Unexpected token '<' api.js:1 in webGL #127

Open
danishkhan3621 opened this issue Aug 21, 2021 · 1 comment
Open

Comments

@danishkhan3621
Copy link

I'm trying to intwegrate WebGL but when i run the same in browser i'm getting this error:

Uncaught SyntaxError: Unexpected token '<'
api.js:1

Uncaught ReferenceError: WE is not defined
    at initialize (index-new.html:7)
<!DOCTYPE HTML>
    <html>
      <head>
        <script src="http://www.webglearth.com/v2/api.js"></script>
        <script>
          function initialize() {
              var options = {
              sky: true,
              atmosphere: true,
              zooming: true
          };
            var earth = new WE.map('earth_div',options);
            WE.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
             
            }).addTo(earth);
          }
        </script>
        <style>
          html, body{padding: 0; margin: 0;}
          #earth_div{top: 0; right: 0; bottom: 0; left: 0; position: absolute !important;}
        </style>
        <title>WebGL Earth API: Hello World</title>
      </head>
      <body onload="initialize()">
        <div id="earth_div"></div>
      </body>
    </html>
@sebastian-marinescu
Copy link

This

Uncaught SyntaxError: Unexpected token '<'
api.js:1

makes me think (know), that the js-file is probably not loaded correctly.

Checklist:

  • In the developer-tools, when you switch to network, what exactly is the response of the requested js-file?
    (like is it really the expected content, or maybe a server-error?)
  • Have you tried downloading the js-file and serving it to your application locally?
  • Or maybe try https and not http

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants