fiddle icon indicating copy to clipboard operation
fiddle copied to clipboard

Fancy launch page

Open MarshallOfSound opened this issue 5 years ago β€’ 5 comments

We have a protocol handler, it would be good to make a https://fiddle.electronjs.org/launch/{gist_id} endpoint that will use any of the fancy techniques we know to detect if fiddle is running and launch it, if it isn't running we can give them a fancy download page with an explanation / overview of what fiddle is.

I can build that page itself and the logic but would need some help making it look nice on the website side of things πŸ‘

MarshallOfSound avatar Jul 26 '18 06:07 MarshallOfSound

fancy techniques we know to detect if fiddle is running and launch it

The only one I've ever been able to think of is having fiddle run a server on localhost and trying to ping it from the website. What are some other techniques?

zeke avatar Jul 26 '18 16:07 zeke

@zeke I do have one! I've been using it at Slack with some success.

  1. Attach a blur event listener on the window.
  2. Open an invisible iframe with the protocol link.
  3. Wait four seconds.
  4. Did we lose focus? If so, the app probably launched.
  5. If not, we're probably still in the browser and nothing happened since the app isn't installed.

Works like a breeze. Might feel a bit dirty but that's sort of the best we have today.

felixrieseberg avatar Jul 30 '18 22:07 felixrieseberg

Very interesting. How did you arrive at four seconds?

zeke avatar Aug 01 '18 22:08 zeke

@zeke It's pretty much an arbitrary number – pick whatever you think is enough to ensure that most machines had enough time to open the target app and that the app managed to steal focus.

felixrieseberg avatar Aug 13 '18 15:08 felixrieseberg

We have a protocol handler, it would be good to make a https://fiddle.electronjs.org/launch/{gist_id} endpoint that will use any of the fancy techniques we know to detect if fiddle is running and launch it, if it isn't running we can give them a fancy download page with an explanation / overview of what fiddle is.

I can build that page itself and the logic but would need some help making it look nice on the website side of things +1

Webpages CAN open protocols directly without iframes. That means that once the protocol has ended the connection, itll close the tab

dragonDScript avatar Oct 10 '21 11:10 dragonDScript