var pageData = CQ.HTTP.get(CQ.HTTP.externalize(CQ.utils.WCM.getPagePath() + "/jcr:content.json"));
After that you can retrieve any property you need (assuming it's present in JCR):
var resourceType = pageData ? CQ.Util.formatData(CQ.HTTP.eval(pageData))['sling:resourceType'] : null;
Please do not overuse it because it invokes additional ajax call to server. It's OK to use it in edit mode on author instance.
Hi What is the way to get component's node value in Javascript using only Core CQ JS API?
ReplyDelete