CF widget JS issue | Community
Skip to main content
Level 5
October 16, 2015
Solved

CF widget JS issue

  • October 16, 2015
  • 3 replies
  • 908 views

Hi

I am facing one issue with my custom contentfinder js. Actually i want to send the page path as the request parameter to CF's view handler. 

/bin/wcm/contentfinder/asset/viewnew.json[requestParam-page path under content]

Issue is i am not able to fetch page path inside widget's js. I tries below 

"url": CQ.shared.HTTP.eval("/bin/wcm/contentfinder/asset/viewnew.json" + window.location.href)

but in network tab its showing request is going as "http://localhost:4502/bin/wcm/contentfinder/asset/viewnew.jsonhttp://localhost:4502/cf#". So in that case i can get http://localhost:4502/cf# as request param. URL that i am hitting is : http://localhost:4502/cf#/content/Company/en/Article.html . But is need content/Company/en/Article.html or content/Company/en/Article as the request parameter.

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

Content finder is url going to be frame. So using window.location returns the location object associated with the current frame and hence cf#/ . If you just want to get the address use window.parent.location.href OR window.top.location OR document.URL  .   Note after getting full url you need to substring  remove host & port

Not sure of your use case might find below url helpful http://experience-aem.blogspot.com/2013/10/aem-cq-56-extend-and-add-filters-to-object-finder-pag-tab.html

3 replies

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

Content finder is url going to be frame. So using window.location returns the location object associated with the current frame and hence cf#/ . If you just want to get the address use window.parent.location.href OR window.top.location OR document.URL  .   Note after getting full url you need to substring  remove host & port

Not sure of your use case might find below url helpful http://experience-aem.blogspot.com/2013/10/aem-cq-56-extend-and-add-filters-to-object-finder-pag-tab.html

vdhim23Author
Level 5
October 16, 2015

Thanks, I got it. Now issue is, when i move from one page to another, contentfinder tab doesn't refresh or reload as my contentfindertab getting the page path & perform the rendition logic so it should reload again to get the new request for new page path, If i reload the page by F5 it works, but how can we automate it.

Sham_HC
Level 10
October 16, 2015

vdhim23 wrote...

Thanks, I got it. Now issue is, when i move from one page to another, contentfinder tab doesn't refresh or reload as my contentfindertab getting the page path & perform the rendition logic so it should reload again to get the new request for new page path, If i reload the page by F5 it works, but how can we automate it.

Theoretically reload the store or configure refresh interval. I haven't tried personally but you should find lot of materials on this by googling.