VF page is opening as modal in Salesforce lightning experience on an action button click. When I look at the generated code,my code is there in an iframe which the salesforce generated modal contains.

I need to perform the same operation on the cancel button(which is on my vf page) as of the cross icon (of the generated modal). I tried getting the modal element by class name and calling the same click event on cancel button,which is getting called on cross icon.

The problem here is, I am not able to access any element outside the iframe. It throws

'Blocked a frame with origin "https://c.na34.visual.force.com" from accessing a cross-origin frame.'

error. window.parent does not help either. Please provide suggestion to solve this.

Thanks in advance.

1 Answer 1


Please have a look at This example. It'll work for you.

  • put this as comment, if you are allowed to Nov 14, 2016 at 4:53
  • Just got the allowance at 50. Will do next time. Thanks. Nov 14, 2016 at 4:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .