1<!DOCTYPE html>
2<html>
3	<head>
4		<title></title>
5		<script type="text/javascript" src="https://js.live.net/v7.2/OneDrive.js"></script>
6		<script>
7			// Extract authentication info from redirect URL in popup window
8			function getAuthInfoFromUrl()
9			{
10				if (window.location.hash != null)
11				{
12					try
13					{
14						var result = new Object();
15						var authResponse = window.location.hash.substring(1);
16						var params = authResponse.split('&');
17
18						for (var i = 0; i < params.length; i++)
19						{
20							idx = params[i].indexOf('=');
21
22							if (idx > 0)
23							{
24								result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
25							}
26						}
27
28						return result;
29					}
30					catch (e)
31					{
32						// ignores parsing errors
33					}
34				}
35
36				return null;
37			};
38
39			// Main
40			if (window.opener != null && window.opener.onOneDriveCallback != null)
41			{
42				try
43				{
44					var authInfo = getAuthInfoFromUrl();
45					var token = authInfo['access_token'];
46					window.opener.onOneDriveCallback(token, window);
47				}
48				catch (e)
49				{
50					alert('OneDrive: ' + e.toString());
51					window.close();
52				}
53			}
54		</script>
55	</head>
56	<body>
57	</body>
58</html>
59