次のコードを使用すると、デスクトップ ブラウザーで新しいウィンドウを開くことができます。
var thisWin = window;
var oauthWin = thisWin.open(data, 'twitter-oauth-window', 'location=0,status=0,width=800,height=400');
var lastUrl = oauthWin.location.href;
var meh = true;
var oauthInt = thisWin.setInterval(
function()
{
if (meh)
{
alert(
'\noauthWin.closed: ' + oauthWin.closed +
'\noauthWin.location: ' + oauthWin.location +
'\nthisWin.closed: ' + thisWin.closed +
'\nthisWin.location: ' + thisWin.location +
'\noauthWin===thisWin: ' + (oauthWin === thisWin));
meh = false;
}
// do more stuff here
}
);
アラート内のデバッグ出力:
oauthWin===thisWin: false
これは、あるべき姿です。ただし、PhoneGap 内で同じコードを実行すると、次のようになります。
oauthWin===thisWin: true
これは、PhoneGap が同じウィンドウで新しい URL を開いて、現在の HTML ドキュメントを置き換えたことを示しています。
新しい URL を個別に開き、特定の条件が満たされたときに閉じて、古い URL に戻せるようにしたいと考えています。
これは PhoneGap で実現できますか?
ありがとう!