1

そのため、新しいウィンドウを開いている親ウィンドウがあります(ステータスバー、ツールバーなどを削除するためだけです)。親ウィンドウを閉じた後、渡された変数は空白の文字列を返します。「リモートサーバーマシンが存在しないか、使用できません」というエラーメッセージが返される場合があります。親ウィンドウを閉じた後でも、この変数にアクセスする必要があります。助言がありますか?

var _env = {};
$(window).load(function()
{
    /**
     *
     * If initialization was not yet performed, start the initialization.
     * Otherwise, show application.
     *
     **/

    if (window.opener)
    {
        /* Start transition to the new window */
        window.blur();
        _env = window.opener._env;

        console.log(_env["title"]);

        /* Show system */
        window.opener.close();
        window.focus();

        console.log(_env["title"]); // Returns blank
    }
    else
    {
        /* Some process manipulating the '_env' variable */
        /* .... */
        /* .... */

        window.open("./index.html", _env["title"], "directories=0, menubar=0, toolbar=0, titlebar=0, resizable=1, width=" + _env["winWidth"] + ", height=" + _env["winHeight"]);
        window.focus();
        window.open("","_self", ""); // To prevent prompt on closing..
    }
});
4

1 に答える 1

0

オブジェクトをJSONに変換し、設定window.location.hrefすることができます。その後、データが必要なときにそれを抽出できます。新しいオブジェクトを作成しているため、参照に問題はありません。

于 2012-11-25T08:49:09.727 に答える