Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Close window programmatically #47

Open
rabashani opened this issue Jan 7, 2018 · 3 comments
Open

How to Close window programmatically #47

rabashani opened this issue Jan 7, 2018 · 3 comments

Comments

@rabashani
Copy link

This sentence isn't clear to me -
"To close the window programatically give the window a ref and use the closeWindow function."

can you share a simple example or usage? or refer to an example in the docs?

@martinnov92
Copy link

Hello,

try it like this:

<Popout
   url='popout.html'
   title='Window title'
   onClosing={this.popupClosed}
   ref={popup => this.popup = popup}
>
  <div>Popped out content!</div>
</Popout>

And then once you need to close it call it like this:
this.popup.closeWindow();

Hope it helps

@dragonfriend0013
Copy link

I am using this in a functional component, and this is not working. I am getting 'Cannot read property 'closeWindow' of undefined'

let popupRef;
...
<PopoutWindow
url={/saml/login?socketId=${id}}
title="Login"
ref={(popup) => popupRef = popup}
onClosing={closePopup}
/>
...
popupRef.closeWindow();

@sidharthancr
Copy link

I have reimplemented the react-popout with IE support and more flexible

https://www.npmjs.com/package/react-popout-v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants