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 ReferenceError: H is not defined #8

Open
lvdiev opened this issue Mar 30, 2019 · 1 comment
Open

Uncaught ReferenceError: H is not defined #8

lvdiev opened this issue Mar 30, 2019 · 1 comment

Comments

@lvdiev
Copy link

lvdiev commented Mar 30, 2019

As your guide, I tried to inject css and js libs into page using below code.

`var styleSheet = document.createElement('link');
styleSheet.href = 'https://js.api.here.com/v3/3.0/mapsjs-ui.css?dp-version=1549984893';
styleSheet.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(styleSheet);

const javaScriptLibs = [
"https://js.api.here.com/v3/3.0/mapsjs-mapevents.js",
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js",
"https://js.api.here.com/v3/3.0/mapsjs-core.js",
"https://js.api.here.com/v3/3.0/mapsjs-service.js",
"https://js.api.here.com/v3/3.0/mapsjs-ui.js",
];

javaScriptLibs.forEach(x => {
var script = document.createElement('script');
script.src = x;
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
});`

Right after these js libs are injected, I got the errors as below:
Can you help me please?

mapsjs-mapevents.js:1 Uncaught ReferenceError: H is not defined at mapsjs-mapevents.js:1
(anonymous) @ mapsjs-mapevents.js:1

mapsjs-ui.js:1 Uncaught ReferenceError: H is not defined at mapsjs-ui.js:1
(anonymous) @ mapsjs-ui.js:1

@lvdiev
Copy link
Author

lvdiev commented Mar 30, 2019

Oh I see the problem. It seems that the js lib some how will execute the code right after injected by above code. But when they are embedded using <script> tag in index.html, they won't execute.

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

1 participant