0

I'm trying to close my browser on logout button click. I know it's not an ideal way of doing things because SiteMinder that my company is using doesn't support HttpSession invalidate and logout functionality. So I will need to close window upon log out. Please see the code below for the implementation. It works fine in IE but it doesn't work in Chrome version 59. Other examples I've found so far in Stack Overflow works only for older chrome version. Can someone advice me the work around ?

export default class PopUp extends React.Component {
    constructor(props, context) {
        super(props, context);
        autoBind(this);
    }


    confirm(){
        var mywindow = window.open('', '_self', '');
        mywindow.close();
    }

    render() {
        return(
            <Popconfirm placement="top" title={this.props.message} onConfirm={this.confirm} okText="Yes" cancelText="No">
                <Button>{this.props.buttonName}</Button>
            </Popconfirm>
        );
    }

}
user4900074
  • 1,695
  • 4
  • 18
  • 24
  • You can close pop-up / tabs opened by `window.open` only, you can't close the top window with `window.close`. – Teemu Sep 11 '17 at 19:31
  • It closes the browser for IE. It only doesn't work in Chrome. Would you know what i should do to close the browser in Chrome ? – user4900074 Sep 11 '17 at 19:37
  • it's not a duplicate. I've seen that answer in that link you provided and it no longer works for chrome latest version. – user4900074 Sep 11 '17 at 20:37
  • 1
    It is a duplicate. To summarise the highest rated answer: You aren't allowed to do it, and the occasional security holes that let you sneak around that restriction get closed sooner or later. – Quentin Sep 12 '17 at 12:25

0 Answers0