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!

2 Answers 2


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 Commented Jun 8, 2017 at 20:45
  • refer my updated answer, it is working perfectly at my DE Commented Jun 8, 2017 at 21:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .