1.

Javascript code to get URL and Its different parts through code?

Answer» JAVASCRIPT code to GET URL and Its different parts through code?
Below is the code to get different part of URL in Javascript
(1)window.location.protocol=This will return "http:" or "https:"
(2)window.location.host=This will return rest part of url LIKE "crackyourinterview.com"
(3)window.location.pathname=this will return the part after .com like "/MainAds-web.aspx"
(4)window.location.search=this will return ?s=search text


Discussion

No Comment Found