3

I am using the react-popout package, which is just a wrapper for window.open and I am trying to create popout windows in React. These windows HAVE to stay on top no matter what, but I am using Google Chrome right now so a lot of the window.open options don't work (alwaysRaised, resizable) etc. I tried looking into onBlur and focus but no concrete so far. Thank you.

Siya Mzam
  • 4,655
  • 1
  • 26
  • 44
SolidSnake
  • 185
  • 1
  • 12
  • You can't force a browser popup to stay on top of other windows (that would open up a lot of possibilities for malicious scripts). Why do you want the popup to stay on top? Related: https://stackoverflow.com/questions/13965584/how-to-make-child-window-stay-on-top – Tulir Jan 12 '18 at 23:20
  • It's part of a functionality I'm recreating at work for an older version of a product done in Java, which I guess allowed popped out windows to stay on top. – SolidSnake Jan 12 '18 at 23:21
  • Have you considered using in-website popups instead? Something like https://github.com/reactjs/react-modal might work. It's just not possible to force an actual popup to stay on top in modern browsers. Many users even block popups altogether, since they're most often used in the wrong situations or for malicious purposes. – Tulir Jan 12 '18 at 23:28
  • Hmm I'll look into it, thanks. But modals aren't really what I'm looking for here. I need to able to have multiple windows popped up upon several clicks from the page, and not be restricted to looking at just one. Unless I'm misunderstanding the modal? – SolidSnake Jan 12 '18 at 23:32
  • You should take a look at React Portals as well. I'm not sure it will achieve exactly what you want, but may give you some more options to consider: https://reactjs.org/docs/portals.html – Jonny Asmar Jan 13 '18 at 00:50
  • 1
    did you ever figure this out? Are you still looking for an answer, as I am having the exact same issue. – Alex Mackinnon Aug 23 '19 at 15:41

0 Answers0