I have issues trying to implementing a logic to close a broswer's tab.

People say I should use a RunJavaScript action and type "window.close()" but that is not working.

I've set the button to Ajax Submit and validation to (none) but it also didn't work.

Hi Miguel,

Did you check the solutions in this post.



Marcelo Ferreira wrote:

Hi Miguel,

Did you check the solutions in this post.



Hey Marcelo, 

Yeah I've tried those.

I've read that you can't close a broswer tab using the javasript "window.close()"

if you didn't open it previously using "window.open()"


Maybe this would work (couldn't test)? 

Execute the following JavaScript:


Edit. Sorry, this is what is in the post pointed by Marcelo. 

But the idea is really this one. The behaviour probably depends on the browser...

Hi Miguel,

As you already figured out, yes, you can't close tabs using JavaScript.

If you try something as simple as placing a link in your page pointing to #, and with this properties:

which generates this HTML:

which should close the tab when clicked, doesn't do anything.

The reason for this is that, and I'm oversimplifying this, you can only use scripts to close script-closable windows, and generally speaking, windows opened by the user aren't script-closeable.

See more here: https://www.w3.org/TR/html51/browsers.html#dom-window-close