Tag Archives: JavaScript
Get parameters from querystring with javascript in SharePoint
To retrieve the querystring parameters through javascript on a SharePoint site you can easily utilize the JSRequest object of MOSS
1 2 3 4 5 |
//you have to call the EnsureSetup method beforhand JSRequest.EnsureSetup(); //i.e get a query string parameter default.aspx?id=5 with id and the method returns 5 id= JSRequest.QueryString["id"]; |
The object allows also to retrieve the page naem and the current path
1 2 3 4 5 |
//get the current file name. i.e - "default.aspx" filename= JSRequest.FileName; //get the current path name. i.e - /site/default.aspx" pathname= JSRequest.PathName; |