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

Fancy launch page #43

Open
MarshallOfSound opened this issue Jul 26, 2018 · 5 comments
Open

Fancy launch page #43

MarshallOfSound opened this issue Jul 26, 2018 · 5 comments

Comments

@MarshallOfSound
Copy link
Member

MarshallOfSound commented Jul 26, 2018

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 👍

@zeke
Copy link
Contributor

zeke commented Jul 26, 2018

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?

@felixrieseberg
Copy link
Member

@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.

@zeke
Copy link
Contributor

zeke commented Aug 1, 2018

Very interesting. How did you arrive at four seconds?

@felixrieseberg
Copy link
Member

@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.

@ghost
Copy link

ghost commented Oct 10, 2021

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

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

3 participants