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

Add a link to be dragged to the bookmark bar #5

Closed
zhouzi opened this issue Feb 19, 2016 · 2 comments
Closed

Add a link to be dragged to the bookmark bar #5

zhouzi opened this issue Feb 19, 2016 · 2 comments

Comments

@zhouzi
Copy link

zhouzi commented Feb 19, 2016

Setting up the bookmarklet is not that easy and might stop some people from using it. It'd be great to add a link to be dragged to the top bar. Right now, the dragon.js file is not hosted on a https site so it wouldn't work on sites that use an ssl certificate.

To solve that, the demo could be moved to a github page which uses https. Then you'd just have to include a link with:

javascript:(function()%7Bvar script%3Ddocument.createElement(%27script%27)%3Bscript.setAttribute(%27src%27, %27https://path/to/dragon.js%27)%3Bdocument.body.appendChild(script)%3B%7D())%3B
@zhouzi zhouzi changed the title Add a link to drag to the bookmark bar Add a link to be dragged to the bookmark bar Feb 19, 2016
@tomhodgins
Copy link
Owner

Hi Zhouzi.

Re HTTPS:

The fact that the Dragon demo page is not hosted on HTTPS shouldn't be an issue, when you're using the dragon.js code as a bookmarklet, 100% of the code of the bookmarklet is stored within your browser so it can be loaded into whatever page you have loaded, whether that page was retrieved via HTTP or HTTPS. It doesn't actually access any code from the network when it runs :)

Re: homepage + link

In my mind, this is a one-line file that I had saved as a Gist (which is version-controlled and publically accessible but not very visible) and so creating an entire github project for it I viewed as making a big homepage for that little bit of code already.

I do think eventually hosting the demo page and more information on Github itself might be a good idea - if the branch is switched to gh-pages and there's an index.html in the repository we would we able to access the test right from Github, as well as have a page where people could drag the link into their address bar.

The reason I have not done this is that Github pages does not yet support HTTPS, and a lack of time :) I've been busy building some new things!

As a method for installing bookmarklets, dragging a link doesn't help you at all in the browsers where adding a bookmarklet needs the most assistance: Mobile Safari (iOS). In the browsers I wrote this too to use, dragging links to an address bar isn't a feature of that browser. Also, many browsers will refuse to display a link to JavaScript (instead of a URL) as a link, meaning that if the purpose of putting a 'draggable link' on the page is to make it easy - if for any reason it doesn't work that's harder to troubleshoot than following the directions of creating a bookmark manually that you can repeat until you get it right.

Here's a link to the JS of Dragon right here, but I'm not sure what I could/would do with this in most of the browsers where I want to use it:

Bookmark Dragon.js

In some, it may not show up as a clickable link simply because the URL isn't to another page.

@zhouzi
Copy link
Author

zhouzi commented Feb 19, 2016

My bad, I've been a bit unclear so in case my point was confusing, here is what I meant. There are two ways to create a bookmarklet:

  1. Add a bookmark and paste the whole library's code, starting with javascript:
    • No http/https issues
    • The library code is not updated when changes are made
  2. Add a bookmark that creates and insert a script element pointing to the script
    • Must be hosted on an https source
    • The library code is automatically updated

But if I've suggested to add a draggable link it is mostly because to give a try to dragon.js I had to find the source code, copy it, add a bookmark and paste the code. While with such link I would have to just drag it to the bookmark bar ^^

Anyway, once again I get your points and the fact that you just want to have fun building things quickly :)

@zhouzi zhouzi closed this as completed Feb 19, 2016
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

2 participants