I want to display the message at another page when user click a button. Such as the user clicks button at Page A, then my action method will redirect user to Page B and show the message which is defined in the Page A controller.
Page A and Page B not use the same controller.
String pageHeaderReferer = ApexPages.currentPage().getHeaders().get('Referer');
if((pageHeaderReferer != null && pageHeaderReferer.containsIgnoreCase('Page1')) || isLtIE9())
{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, message));
}
Be careful, using the above code in IE8 that there is no 'Referer' value.