0

In my visualforce page, I'm trying to close the current tab in "OnComplete" function in apex:actionFunction. I tried using both window.close() and window.top.close(). But nothing worked out.

Any idea on this ?

1 Answer 1

1

According to the mozilla documentation,

... for security reasons, scripts are no longer allowed to close windows they didn't open.

So the question here would be... is your window open with a script? if not, then you can't close it with javascript.

A longer answer was provided here

3
  • This visualforce page is opened on a custom button click from the record detail page.
    – sfdcOwl
    Commented May 6, 2020 at 10:15
  • @sfdcOwl, please add in your original post the code you have so far (related to the window.close() so we can see what could be wrong ;) Commented May 6, 2020 at 12:53
  • My bad !!! After modifying the code, I didn't click on the custom button to re-test it. I just tried by refreshing the vf page. It's working now.. Thanks @Sergio for your answer
    – sfdcOwl
    Commented May 7, 2020 at 5:31

You must log in to answer this question.

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