0

Is there a way to pass development browser flags in IntelliJ Idea (or WebStorm) ? (as it is in chrome "unsafely-treat-insecure-origin-as-secure" StackOverflow answer)

IntelliJ IDEA react-app config

If I try to get user geolocation with

navigator.geolocation.watchPosition

I get this error and it doesn't allow me to debug my webapp directly from IntelliJ

geolocation unsafe origin error

But I successfully debug it in Chrome in dev tools

Seems to be in IntelliJ there is no place to add dev-flags

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Alexey Nikonov
  • 4,958
  • 5
  • 39
  • 66

1 Answers1

2

Settings (Preferences on macOS) | Tools | Web Browsers

Go there, find your browser (or just create your own custom entry) and add command line arguments or select custom data directory (that points to existing user profile) there.

enter image description here

To ensure that those flags/params will be applied you would need to have that browser closed when launching your Run/Debug Configuration.

In your case you should add --unsafely-treat-insecure-origin-as-secure="http://192.168.1.101:3000" or any other flag separated with a space.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • thanks for your help, do i need to add just ```'unsafely-treat-insecure-origin-as-secure'``` or it must be something like ```'unsafely-treat-insecure-origin-as-secure=true'```? – Alexey Nikonov Feb 11 '21 at 19:59
  • @AlexeyNikonov See the question you have quoted, just a different answer: https://stackoverflow.com/a/37590176/783119 – LazyOne Feb 11 '21 at 20:19
  • could you check my edit and reject/apply them? I hope they will be helpful for others – Alexey Nikonov Feb 13 '21 at 11:37
  • @AlexeyNikonov Are you sure about `http://localhost:8100` part? Looking at your first screenshot I would expect a different host:port details there. – LazyOne Feb 13 '21 at 11:41
  • yea, you're right, in my config (on my pc) I've changed it and used the flag successfully, but here it was kind of typo. I've corrected that according to my example – Alexey Nikonov Feb 13 '21 at 12:02