Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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="'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

After some research I've found a difference between URL of the both pages.

Managed package visualforce page with that command button:

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:          <- this works     <- 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?

share|improve this question
up vote 3 down vote accepted


  1. URL No Longer Exists
    • Error is happening because your path to the page is incorrect and is missing the leading / which creates a URL which is relative to the current page rather than relative to the host.
  2. Path to the page outside of the managed package namespace
    • The default VF namespace is c__ and you can specify this in your page path. This allows you to avoid hardcoding a fully qualified URI.

<apex:commandButton value="Open" onclick="'/apex/c__MyPage'); return false;" />

Related: How to redirect to default namespace vf page from managed package vf page?

share|improve this answer
ooh, didn't know about the __c prefix, nice – executeanon Sep 1 '14 at 18:08
WOW! Great hint Mark, didn't know about c__PageName, but this is so obvious! :) Many thanks. – Sergey Utko Sep 2 '14 at 6:58

I think pages opened from within a managed package must always be fully qualified with the full URL, so your button would have to be:

<apex:commandButton value="Open" onclick="''); return false;" />

Obviously, this will give you some challenges to get the correct pod in your URL, but other than that should work.

I believe it is indeed a feature of managed packages.

share|improve this answer
I've just tried to hard code the whole correct URL (w/o prefix) to the button and a popup page opens correctly. So the challenge is to generate this URL without prefix dynamically :) Thanks. – Sergey Utko Sep 1 '14 at 14:43
Would a custom setting be dynamic enough perhaps? – executeanon Sep 1 '14 at 14:56
I dont think so. It is not always the same. – Sergey Utko Sep 1 '14 at 15:05

I'm not sure that this will solve your problem but try this one :

< apex:commandButton value="Open" onclick="'{!$Page.MyPage}'); return false;" />
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.