วิธีการ - รับ URL ปัจจุบันด้วย JavaScript
เรียนรู้วิธีรับ URL ปัจจุบันด้วย JavaScript
URL ปัจจุบัน
ใช้window.location.href
เพื่อรับที่อยู่ URL ปัจจุบัน:
ตัวอย่าง
document.getElementById("demo").innerHTML =
"The full URL of this page
is:<br>" + window.location.href;
อ่านเพิ่มเติมเกี่ยวกับwindow.location
วัตถุในบทแนะนำตำแหน่งหน้าต่าง JavaScriptของ เรา