i have 2 vf pages, in 1st vf page there is button with onclick action = open window with provided URL,

  <apex:column styleclass="inBorder1">
    <apex:facet name="header"></apex:facet> 
        <apex:outputLink onclick="window.open('http://jforce-developer-edition.ap5.force.com/message2');">
         =<apex:image style="height:25%;width:60%" value="!$Resource.apply1}"/>       

But i want open this new vf page in same window. i.e. instead of opening new window it should open new vf page in same window.

Thanks for your time!


you can use plain old javascript window.location.href = "http://stackoverflow.com"; to redirect the client to a new page..


Use URLFOR() with apex:outputLink

Refer apex:outputLink

target - The name of the frame where the resource retrieved by this command link is displayed. Possible values for this attribute include "_blank", "_parent", "_self", and "_top". You can also specify your own target names by assigning a value to the name attribute of a desired destination.

<apex:outputLink target='_self' value='{!URLFOR($Page.Page2, null, ['id'=id])}'>
    =<apex:image style="height:25%;width:60%" value="!$Resource.apply1}"/>  
  • Its not redirecting to new vf page (message2). Its refreshing same page Jun 8 '17 at 20:45
  • refer my updated answer, it is working perfectly at my DE Jun 8 '17 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.