DOCTYPE html html head title VK API title meta charset utf-8 script sr

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<head>
<title> VK API</title>
<meta charset="utf-8" />
<script src="http://vk.com/js/api/openapi.js" type="text/javascript"></script>
<script type="text/javascript">
var APP_ID = 4577480;
var API_ID = 4577480;
VK.init({
apiId: APP_ID
});
</script>
</head>
<body>
<div id="dd" class="name">
Hello !
</div>
<div id="vk_api_transport">vk text</div>
<script type="text/javascript">
window.vkAsyncInit = function() {
VK.init({
apiId: APP_ID
});
};
setTimeout(function() {
var el = document.createElement("script");
el.type = "text/javascript";
el.src = "http://vk.com/js/api/openapi.js";
el.async = true;
el.style = "";
document.getElementById("vk_api_transport").appendChild(el);
}, 0);
VK.init({
apiId: API_ID
});
function authInfo(response) {
if (response.session) {
alert('user: '+response.session.mid);
} else {
alert('not auth');
}
}
VK.Auth.getLoginStatus(authInfo);
VK.UI.button('login_button');
</script>
</body>
</html>