I am trying to open a normal visualforce page (that is NOT a part of the managed package) from a visualforce page that is IN managed package.
This button I have on the visualforce page in manage package:
<apex:commandButton value="Open" onclick="window.open('apex/MyPage'); return false;" />
The MyPage
is NOT in the managed package.
By clicking on the button a new popup window appears, so javascript works well.
But the problem is that I am getting the following error message and no content of the MyPage
:
URL No Longer Exists
You have attempted to reach a URL that no longer exists on salesforce.com.
After some research I've found a difference between URL of the both pages.
Managed package visualforce page with that command button:
https://customDomainName--PREFIX.csXX.visual.force.com/apex/PageInManagedPackage
Another page that should be opened (MyPage
, not in managed package) is opened with the same prefix in URL. But if I replace the PREFIX with a c
then the page will load without problems:
https://customDomainName--c.csXX.visual.force.com/apex/MyPage <- this works
https://customDomainName--PREFIX.csXX.visual.force.com/apex/MyPage <- this not
How you can see the only difference is that external page opened with a prefix in URL could not be shown :(
My question is, what is wrong with my button? Why an "external" page opens with a wrong URL? Is it a managed package "feature"? How can I avoid this?