I am customize the DispForm.aspx with some javascript code. I would like to get in javascript the path of the current listitem. How can I do that?
UPDATE:
I have now this code to get the path/url of the current listItem. Is it OK or can it be better?
// get list ID
var listId = _spPageContextInfo.pageListId;
var cleanListId = listId.replace('{','').replace('}','');
// get item ID
JSRequest.EnsureSetup();
var itemid = JSRequest.QueryString["ID"];
// get current site collection url
var currentSiteCollectionFullUrl = window.location.protocol + '//' + window.location.host + _spPageContextInfo.siteServerRelativeUrl;
// generate path of current listitem
var path = currentSiteCollectionFullUrl + '_layouts/15/listform.aspx?PageType=4&ListId=' + cleanListId + '&ID=' + itemid;