Skip to content

Instantly share code, notes, and snippets.

@glassesfactory
Created November 1, 2011 12:59
Show Gist options
  • Save glassesfactory/1330452 to your computer and use it in GitHub Desktop.
Save glassesfactory/1330452 to your computer and use it in GitHub Desktop.
twitter OAuth 認証を別窓で処理する
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<title></title>
<meta name="google" value="notranslate">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
if(!window.opener || window.opener.closed){
}
else{
//親ウィンドウの、認証完了時の処理を呼ぶ
window.opener.dispatchAuthComplete();
window.close();
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<title></title>
<meta name="google" value="notranslate">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="common/swf/swfobject.js"></script>
<script type="text/javascript">
/*
swfobject 的な処理
*/
var swfID = '';
setSwfName = function(id){
swfID = id;
}
//認証が完了して、コールバックを受け取った時子窓から呼ばれる
dispatchAuthComplete = function(){
//swf の addCallBack で追加したメソッドを呼ぶ
swfName(swfID).callback();
}
//IE対策
swfName = function(str){
if (navigator.appName.indexOf("Microsoft") != -1){
return window[str];
}
else{
return document[str];
}
}
</script>
</head>
<body>
<div id="flashContent">
<!-- swf 貼付け -->
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment