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

New Window


  Could any one help me with the apex code ,where a new window has to be opened,

   i have already tried with but that's not working properly , please help 

   me how would i achieve this.


  Thank you




It isn't possible to do this in apex. Apex is the Object-orinetated Java like language used for developing controllers, triggers an classes that run on the platform.


What you need to do is change your command button on your Visualforce page to have an onClick event that calls the javascript command.




You can do this through javascript.Try the below code as reference:
/////////////////////// VF Pages ////////////////////////////////
<apex:page sidebar="false" standardStylesheets="false" controller="LinkController">

<apex:outputPanel styleClass="app-icon" layout="block" id="app">
<apex:form >
<apex:commandLink action="{!Save}" reRender="app" value="rediff" onclick="WindowNew()">
function WindowNew()

/////////////// Controller /////////////////////////
public class LinkController {

public PageReference Save()


String newPageUrl = '';

return null;



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 



The new window is opened in a new Tab,

i have already tried with a similar approach.But what i am looking for is the new window has to be opened as if its a popup

which also has a title bar and address bar, similar to browser popup


The tab/window thing is a preference set by the user in the browser. You shouldn't override it.


Ifyou really must (I would reiterate thinking hard about it first) then do:'','_blank','toolbar=0,location=0,menubar=0');