so I have a page reference implemented in my apex page

PageReference mypage=new PageReference('http://10:7:8...') 

which should ideally be opening in a new tab hitting the url mentioned on the click of a command button. However for the past couple of days the on clicking the button the following thing happnes

  1. the word webpage gets appended in the url along with the base url so it is like https://domainseal--navsbx.lightning.force.com/webpage/

  2. Along with this the page reference url gets appended in the encoded format so for example if the pagereference url is https://meyerweb.com/eric/tools/dencoder/ it is being displayed as https%3A%2F%2Fmeyerweb.com%2Feric%2Ftools%2Fdencoder%2F in the url

so in essence the final url which is showing up on clicking the command button is

The base url/webpage/encoded pagereference url 

and the page is showing with a message

"This page isn't available in Salesforce Lightning Experience or Salesforce1"

and also using command link and using target=_blank is not possible since there are validation checks involved which will not be visible since it will invariably open in the new tab

  • Need urgent help on the issue Jan 13, 2019 at 16:41

1 Answer 1


you can put your command button wrapped in command link like below.

<apex:page controller="testURLNavigationCtrl">
    <apex:commandlink action="{!navigateTogoogle}" target="_blank">
        <apex:commandButton  value="redirect" />

That will open a new window.

and leave your Page reference method as it is.

   public PageReference navigateTogoogle(){
   PageReference pageRef = new PageReference('http://www.google.com');
    return pageRef;

That should work.

  • No,since there are validation checks as i mentioned in the controller itself,it wont display those apex:page errors ,instead it will reirect to the url invariably Jan 14, 2019 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .