このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

HTMLAreaElement: toString() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2017年3月.

HTMLAreaElement.toString()文字列化メソッドで、 URL 全体の入った文字列を返します。 これは、 HTMLAreaElement.href の読み取り専用バージョンです。

構文

js
toString()

引数

なし。

返値

この要素の完全な URL の入った文字列です。

エリア要素で toString を呼び出す

js
// <area id="myArea" href="/ja/docs/HTMLAreaElement"> 要素が文書にあったとします
const area = document.getElementById("myArea");
area.toString(); // 'https://developer.mozilla.org/ja/docs/HTMLAreaElement' を返す

仕様書

Specification
HTML
# dom-hyperlink-href-dev

ブラウザーの互換性

関連情報