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
SimrinSimrin 

Apex page url in javascript

Hello,

I want to detect the apex page url in javascript.

I am not sure if this is correct forum to ask this question.
Best Answer chosen by Simrin
BDatlaBDatla
Hi Simrin,

Please check with the below code :

function currentPage(){

    return {!$CurrentPage.parameters.relatedId};

}
     
Please add functinality based on your requirement within the method.

Regards,
BDatla

All Answers

sandeep sankhlasandeep sankhla
Hi Simrin,

There are many option please use these

in class:
public String getReferer() { return ApexPages.currentPage().getHeaders().get('referer'); }Then you can just get this in your page using:
In page :<apex:outputText value="{!Referer}"/>

-----------------------

Let me know if this works..we have another options also..
also you can refer below links:
http://www.salesforce.com/docs/developer/pages/Content/pages_quick_start_query_params_getting.htm

Please mark this as best answer if it helps you.
 
SimrinSimrin

I have a javascript function whcih should beahave differently for different pages.  I want it in javascript function only

BDatlaBDatla
Hi Simrin,

Please check with the below code :

function currentPage(){

    return {!$CurrentPage.parameters.relatedId};

}
     
Please add functinality based on your requirement within the method.

Regards,
BDatla
This was selected as the best answer