ネクストエクスペリエンス クライアントサイドスクリプティングのグローバル変数

  • リリースバージョン: Xanadu
  • 更新日 2024年08月01日
  • 所要時間:1分
  • ネクストエクスペリエンス グローバル変数は、 ネクストエクスペリエンス がページに適用されるかどうかを判断するためにクライアントスクリプトで使用されます。

    NOW.isUsingPolaris
    ネクストエクスペリエンスが現在のページに適用された場合は true を返します。
    NOW.isPolarisWrapper
    ページがネクストエクスペリエンス 統一ナビゲーションで実行されている場合は true を返します。このグローバル変数は 統一ナビゲーションにのみ存在します。

    統一ナビゲーション の詳細については、「ネクストエクスペリエンス 統一ナビゲーション の使用」を参照してください。

    クライアントスクリプト:

    // Reload the current page in the unified navigator if not currently in the unified nav
    if (NOW.isUsingPolaris && (!top.NOW || top.NOW.isPolarisWrapper !== "true")) {
        var currentPath = window.location.pathname + window.location.search;
        top.window.location.href = "/now/nav/ui/classic/params/target/" + encodeURIComponent(currentPath)
    }