JavaScript

JavaScriptのdocument.locationの使い方を解説

originメソッドを使えばurl正規表現置換の手間も省ける。

document.location.href
“https://tpc.googlesyndication.com/safeframe/1-0-9/html/container.html”
document.location.origin
“https://tpc.googlesyndication.com”
document.location.pathname
“/safeframe/1-0-9/html/container.html”
document.location.host
“tpc.googlesyndication.com”
document.location.protocol
“https:”

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です