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
Lightning UserLightning User 

How can you close a Visualforce page?

Pretty self explanatory...I want to make a button that closes the visualforce page...and no, window.close() doesn't work :robotmad:
Hey , I'm having the same problem. Tried a lot of things and still can't get around this problem.
Anyone has found a way to close a VF page????


Richie DRichie D
Does this work for you?


It's because the iframe is embedding into the page.

Keep in mind that if the user is not in developer mode there will not be a window.parent.
Richie DRichie D
You don't need to be in developer mode to need the parent object. My page is rendered inside an iframe and therefore I need a parent in the statement.

If I was in development mode then I'd need an extra parent (this.parent.parent.window.close()) potentially...

my html output looks like:-

<iframe  frameborder="0" height="600px" id="itarget" name="itarget" scrolling="auto" src="/apex/wiz_Homepage" title="Content" width="100%"></iframe>

if you see anything like this you'll need the parent in your VF page.


Richie D wrote:

If I was in development mode then I'd need an extra parent (this.parent.parent.window.close()) potentially... would be useful in this scenario.
Lightning UserLightning User
Thanks, used My page was not in an iframe though.

Message Edited by Gillberg on 09-03-2008 06:58 AM
Alexis KasperaviciusAlexis Kasperavicius

<apex:commandButton onClick=";"  value="Close" />