Page include not loading - possible clickjack issue?

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
I have a Skuid page that contains a page include of another skuid page. Everything works as expected if my VF markup is:

<apex:page standardController="PO__c" recordSetVar="c" extensions="skuid.Redirects" action="{!redirect}?actionType=Tab&objecttype=PO__c">
</apex:page>

Unfortunately, the included page makes use of a controller extension via remoting and the above markup doesn't give me visibility to the remote methods. To do so, I use the following markup:

<apex:page docType="html-5.0" readOnly="true"
   standardController="PO__c" recordSetVar="c" extensions="MyController">
   <skuid:page objectType="PO__c" actionType="Tab" />
</apex:page>

However, when changing to the above markup, the included page seems to encounter a clickjack issue as instead of the inner page in Skuid, another SFDC page is displayed (this seems to happen when clickjack is encountered normally).

I've tried using the skuid.Redirects markup and appending ",MyController" to the extensions attribute but when the remoting method is attempted, the object isn't defined.  I'm assuming this is because after the redirect, skuid doesn't load in the additional controllers that were specified.

I'm trying to achieve a reusable page that I will include on all of my other skuid pages but I need to be able to call the remote method from the included page.

Thoughts/suggestions/alternatives?

Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Hi Barry,

When you use the Skuid Page Component method for injecting Skuid into your Visualforce page, your page will run in the your local namespace instead of the Skuid namespace.  This means that for certain functionality to work correctly, you will need to make some local copies of Visualforce pages in the Skuid package.

For page includes to work correctly, you will need to make a local copy of the "Include" Visualforce page that is part of the Skuid package.  Just copy and paste the Visualforce markup into a new page called "Include".

For the file upload component, you'll need to make a local copy of the "UploadImage" page.

For table exports, you'll need to make a local copy of the "ExportData" page.

These pages have remained basically the same for a long time, so there shouldn't be an issue with keeping the local ones updated. 
(Edited)
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hello Ben -

Thank you for the quick reply!  I've added a page to our org (default/empty namespace prefix) called Include pasting the code from the Include page in the skuid namespace.  Unfortunately, the page include lightbox "Loading..." never dismisses and the included page doesn't display.  The page does work properly in Preview mode (it worked in preview mode before as well).

I have a feeling I'm not following the steps properly as you described.

1) Is there something additional I need to do?
2) How does SFDC know to use my version of Include instead of the Skuid version?

Thanks!


Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Hi Barry,

That is all you should have to do.  When you use relative links in Visualforce, it assumes that you're looking for pages in that same namespace.

For example, /apex/Include will load Skuid's Include page if you're running from a page that is in Skuid's namespace like the "UI" page, but /apex/Include will load your local version if the page you're running from is a local page.  You can explicitly specify the namespace of a page by doing something like this /apex/c__Include or /apex/skuid__Include but I don't think that option is available in skuid.

Can you let me know if you have any Javascript errors in your Javascript console?  If we still can't figure this out, can you give access to your org to Skuidify LLC and give me the name of the page in question?  Then I'll be able to take a look.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hello Ben -

Sorry, meant to mention in my last email that there are not any errors or warnings in javascript console.

That said, your last reply led me down the path to realize what the problem was.  When I was encountering the issue, I was logged in as one of our standard users.  Unfortunately, when I created the new "Include" VF page as you described, I had neglected to give the user profile of that user permission to the new "Include" page.  Once I did that, all worked exactly the way you indicated it would.  

Strange that no error appeared in the console indicating the call failed due to security (possibly something that you guys could look in to) but the good news is that I'm back in business with a Page Include that is able to call controller extensions via remoting.

Thank you again!
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Glad to hear you got it worked out.  This post partially inspired this new article in our documentation.  This has a lot more detail than what I posted.
http://help.skuidify.com/m/page-assignments-and-overrides/l/201793-using-the-skuid-page-visualforce-...
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
This is great Ben, greatly appreciate the help and the quick action on providing the doc page.  Keep 'em coming!!