I have a visualforce page where I'm trying to show the mini page layout when the user hovers over a link. I tried using the technique described here: https://www.xgeek.net/salesforce/use-salesforce-mini-page-layout-in-visualforce-page/.

<a href="/{!acc.id}"
 onfocus="LookupHoverDetail.getHover('lookup{!acc.id}opp4', '/{!acc.id}/m?retURL=/{!acc.id}&isAjaxRequest=1').show();"
 onmouseover="LookupHoverDetail.getHover('lookup{!acc.id}opp4', '/{!acc.id}/m?retURL=/{!acc.id}&isAjaxRequest=1').show();">

That works just fine for classic, but in Lightning i get the following error:

Uncaught DOMException: Blocked a frame with origin "https://[MASKED]--c.na50.visual.force.com" from accessing a cross-origin frame.

I tried using the full url in place of the relative path "/{!acc.id}/m?..." so it was "https://[MASKED].lightning.force.com/{!acc.id}/m?...", but then I got a CORS error:

XMLHttpRequest cannot load https://[MASKED].lightning.force.com/[MASKED]]/m?retURL=/[MASKED]&isAjaxRequest=1. Redirect from 'https://[MASKED].lightning.force.com/[MASKED]/m?retURL=/[MASKED]&isAjaxRequest=1' to 'https://[MASKED].my.salesforce.com/[MASKED]/m?retURL=/[MASKED]&isAjaxRequest=1' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://[MASKED]--c.na50.visual.force.com' is therefore not allowed access.

I'm using MyDomain also, but classic doesn't seem to have an issue with that. Is this failing because LookupHoverDetail is defined in main.js which is included from a .visual.force.com domain and the rest of my code is in the lightning domain? How can I get this feature to work with Lightning?

  • i don't think this feature will work with lightning. you could checkout the Lightning Popover however, you will need to code further to add the desired functionality.
    – glls
    Aug 11, 2017 at 21:49
  • Thanks @glls. This is part of a managed package. Sounds like the mini layout is a classic only thing and we'll have to build something custom.
    – Donuts
    Aug 11, 2017 at 22:09
  • Indeed, howeve,r if you check the documentation you will see that it allows you to customize pretty much anything you want in it (within the boudnaries of lightning)
    – glls
    Aug 11, 2017 at 22:28
  • The thing I'm really after is the mini page layout in Lightning - I can show a pop-over a number of ways.
    – Donuts
    Aug 12, 2017 at 9:02
  • I think this is not possible, but I can recommend use of strike components - they have a Popover component that looks perfect Aug 15, 2017 at 6:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.