document.documentURI example
RUN
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> div { color: black; margin: 10px 0px; text-align: center; background: yellow; width: 400px; height: 50px; } </style> <body> <h1>Học lập trình miễn phí tại freetuts.net</h1> <div id="result"></div> <button onclick="myFunction()">Xem kết quả</button> <script> function myFunction(){ var location = document.documentURI; document.getElementById("result").innerHTML = location; } </script> </body> </html>
PHÓNG TO