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

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 May 6 '20 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 ;) – Sergio Alcocer May 6 '20 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 May 7 '20 at 5:31

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.