Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react router get host js

// use window.location which has the fields:
// host, hostname, href, origin, pathname, port, protocol

window.location.host // e.g. "localhost:3000"
window.location.hostname // e.g. "localhost"
window.location.href // e.g. "https://localhost:3000/your-path"
window.location.origin // e.g. "https://localhost:3000"
window.location.pathname // e.g. "/your-path"
window.location.port // e.g. "3000"
window.location.protocol // e.g. "https:"
 
PREVIOUS NEXT
Tagged: #react #router #host #js
ADD COMMENT
Topic
Name
6+8 =