Answer the question
In order to leave comments, you need to log in
Why does the VK.init initialization problem occur?
Good day to all.
I can't understand why VK.init doesn't work.
And I'm not sure yet, but I had to do it right. At the beginning, I went to the "create an application" item. I chose the item "Standalone-application". Next, I set up the website address and base domain. I used github pages.
And then, in the end, I wrote the following code (as in the documentation):
<!DOCTYPE html>
<html>
<head>
<title>Test VK API</title>
<script src="https://vk.com/js/api/openapi.js?153" type="text/javascript"></script>
<script type="text/javascript">
VK.init({
apiId: MY_ID
});
</script>
</head>
<body>
</body>
</html>
MY_ID
is the id of my application. openapi.js?153:434 Uncaught TypeError: Cannot read property 'insertBefore' of undefined
at Object.VK.init (openapi.js?153:434)
at (index):8
root = document.getElementById(VK._rootId);
if (!root) {
root = document.createElement('div');
root.id = VK._rootId;
body = document.getElementsByTagName('body')[0];
body.insertBefore(root, body.childNodes[0]);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question