SYNCERのロゴ
アイキャッチ画像

Document.location - ロケーション

locationは、Documentのプロパティです。ドキュメントのロケーション(Location)を返します。Window.locationと同じです。

概要

名前
location
所属
Document
IDL
[PutForwards=href, Unforgeable] readonly attribute Location? location;
仕様書
https://html.spec.whatwg.org/multipage/history.html#dom-document-location

説明

ロケーション(Location)を返す。読み取り専用なので、値を代入して変更することはできない。

デモ

Document.locationのデモです。

<!-- このコードは編集できます。 -->

<!DOCTYPE html>
<html>
<body>
<script>
var value = document.location ;

console.log( value ) ;
document.body.appendChild( new Text( value ) ) ;
</script>
</body>
</html>

サポート状況

ChromeFirefoxSafariEdgeIEOperaiOS SafariAndroid
  • Twitterでシェア
  • Facebookでシェア
  • Google+でシェア
  • はてなブックマークでシェア
  • pocketに保存
  • LINEでシェア
更新履歴
2017年10月5日 (木)
コンテンツを公開しました。