function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dinesh SFDCDinesh SFDC 

PageReference is removing keywords from url

Hello,

I am passing url as "/MyAccount#tab_reservations" in PageReference but pagereference is autometiocally removed "#tab_reservations" from url. 

Need an assistance how to redirect to full url.


Thanks.
Abhishek BansalAbhishek Bansal
Hi Dinesh,

I am not able to undesrtand that why are you using "#" in your URL.
Generally we use "?" and "&" to indicate any parameters in the URL.
It would be good if you can post your complete code here in order to help you.

Regards,
Abhishek.
Dinesh SFDCDinesh SFDC
Hello Abhishek,

I am using bootstrap tab on my visualforce page. Bootstrap tab is replace the url with # +'specific tab name'.

My requirement is when we redirect to this page then perticular tab should be selected & this is possible if we redirect with #+tab name.

please check.

Thanks,
Dinesh Yadav
Abhishek BansalAbhishek Bansal
Hi Dinesh,

Instead of returning URL form PageReference, You should use a JavaScript method and open your required page from this JS method.
It will not change your URL and you will see #tab_name in URL.
I am providing you the simple Demo Code below:
 
//Vf Page Code :

<script>
    function opennewtab(show){
        window.open('/apex/YOURPAGENAME#tab_Name', '_blank');
	}
</script>
<apex:commandButton value="Test" action="{!Test}" oncomplete="opennewtab();">

//Controller Class Code :

public PageReference test (){
    //Perform any action
    return null;
}
Please modify your code as above code.
Let me know if you still have any issues.

Regards,
Abhishek.