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

get referer returning null



I try to get the referer, but it returning me null when I run it.          


Here the code that I put in extension


String mktg_ref= (String)ApexPages.currentPage().getHeaders().get('Referer');



This is example of page that I run


Please advise.






do u want to get the id from the url or not? 


Generally referer will be useful when the URL that is either included or linked to the current request's URL....i.e if you have 2 pages like x and y and if you call y from x page then you can get the values of from y page by using that referer value...


if you just need the id from the given url u can do like below





Hi kiran_mutturu,


No, I don't want to get Id. I want to get referer where the page come from.


I also try to run  


It return no Referer.


If I create a button in the object itself and link it to the page, it will return the Referer. But if I create site and run the page, it won't.


I just wonder how to ensure Referer is available in Header?