Expand my Community achievements bar.

SOLVED

CF widget JS issue

Avatar

Level 5

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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...

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

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...

Avatar

Level 5

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.

Avatar

Level 10

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.