As I understand your question, you have a Visualforce page that has a header and a footer embedded in it. Both the header and the footer, along with each Visualforce page that uses these controllers has a controller. Each header and footer has code that calls a method in the controller using html that looks something like:
<a class="nav" id="cMethod" href="#" onclick="ControllerMethod(); return false;">C</a>
From your description, it sounds as though your
home page controller contains this referenced
ControllerMethod as does the
headerPageController and each
otherPageController that's used. If I'm mistaken, please correct this assumption as it's not entirely clear whether or not the
home page controller includes the
ControllerMethod. It does sound however as though each
otherPageController includes the method. Again, please clarify if this is not correct.
What I believe is happening here would be an issue related to Visualforce Order of Execution. Because all of these controllers have a method of the same name, only the method in the first custom controller would be called. If the first controller listed on the page did not contain the method, then the next controller listed on the page that contained the method would be the one from which it would be called.
If this were a
standard controller being used for the page, and an extension were listed in the
Apex:Page definition, the first extension of several that contained the method of that name, would be the one from which it would be called.
<apex:page controller="Account" Extensions="headerPageController", "footerPageController">
In the above example, a method of the same name would always be called from the headerPageController, never from the footerPageController.
A custom controller cannot be extended. Any methods of the same name would always be called from the original custom controller and NOT from any other controller listed on the page unless it were the controller for a component. Perhaps what you might want to consider doing is making your headers and footers a component instead of creating them as pages of their own.
After seeing your code and your method, along with understanding that your Home Page does not have a controller, I believe I now understand the issues. It appears that what you're trying to do is to create a behavior where clicking on that link takes someone to the top of a page. It's having the
href="#" that makes the link active by associating it with
some page link. If that's your desire, I recommend you create an
top and apply it to the first element in the visual hierarchy for each of your pages.
It appears to me that what's happening here is that since you don't have a controller on the Home page, the initial
PageReference that's returned is ignored since it isn't of the form
# then acts like a regular html anchor, causing the link to send the user to the top of the page when its clicked on.
# isn't located at the end of the PageReference, where it needs to be, when your Action Method returns
someurl to the Home Page, with no controller on that page, the Browser Window doesn't know what to do with it other than move the cursor to the top of the page. However, when you're on other pages, those pages each have a controller that maintains the current PageReference and has control over the Window. That's why there's no change.
Your method needs to get the
current PageReference and return it, plus append the anchor
# to it, preferably with an
Id that will move the cursor to a specific location on the page. Thus, my recommendation to return a
PageReference of the
Current Page + #top, provided of course that you can put an Id of that sort at the top of each of your pages.