Play Games

Search This Blog

Monday, October 19, 2015

How to get current page parameter (url parameters) value in javascript function of visualforce page


syntax: var paramValue = '{!$CurrentPage.parameters.urlParameter}' where urlParameter is the url parameter name.

Example:
        Visualforce Page :

  <apex:page >
  <script>
      window.onload = function loadPage() {
          var paramValue = '{!$CurrentPage.parameters.oppId}';
          alert(paramValue);
      }
  </script>
</apex:page>

If you run the above vf page by passing oppId parameter like below
"https://c.ap2.visual.force.com/apex/urlParameter?oppId=00628000003CrDz"
then in the alert you will get the required parameter value.