Getting the current page url with Javascript
 

Getting the current page url with Javascript

window.location.href : It is located on which page it gives you the full link.

window.location.pathname : Getting current page pathname.

 

Sample :http://www.engincode.com/Makaleler/network/wireshark-giris-/35  Let us page.

var path = window.location.href;
path value http://www.engincode.com/Makaleler/network/wireshark-giris-/35  will.

 

var path = window.location.pathname;
path value  /Makaleler/network/wireshark-giris-/35  will.

 

Sample If we want to get the value of 35 in the same page link

var path = window.location.pathname.split('/')[4]

path value 35 will.

 

Author: Engin ATALAY
Date: 10.09.2013 14:59:40
View Count: 1969
 
 

COMMENTS
 
No comments yet. Be the first to comment who you are.
 
 
 
 
 
 
 
WRITE COMMENT
 
 
Your Name :
 
 
 
E-mail :
 
 
 
Your Message :
 
 
 
 
 
 
 
This project : ASP.NET MVC , RAZOR, Entity Framework , CSS , HTML , JQUERY(2.0.2) , AJAX the C# side-tier architecture was developed with logic.
 
Yukarı Çık