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

bookmarklet doesn't work on local files because of its use of a protocol-relative URL #130

Closed
sampart opened this issue Jun 14, 2018 · 2 comments

Comments

@sampart
Copy link

sampart commented Jun 14, 2018

If you open an HTML file from your local machine, it'll have an address starting file://. However, the tota11y bookmarklet includes this code: tota11y.src='//khan.github.io/tota11y/tota11y/build/tota11y.min.js'

This results in an attempt to load file://khan.github.io/tota11y/tota11y/build/tota11y.min.js', which fails. So the bookmarklet can't be used on local files without modification.

This line could be changed so that it begins with https:// rather than just // and that would solve this problem.

(Note that Paul Irish also considers protocol-relative URLs an antipattern (see update at the top of https://www.paulirish.com/2010/the-protocol-relative-url/), so that might be another reason to no longer use them.)

Thanks for a great tool!

ccarpita added a commit to ccarpita/tota11y that referenced this issue Oct 8, 2018
The bookmarklet currently uses a protocol-independent URL to load the source, which means that pages viewed locally (`file:///`) will attempt to also load the library from the file tree, rather than the CDN. There is no compelling reason to load the asset on http vs https, even when viewing a plain-http page, and thus the protocol should be set to https explicitly.

Fixes jdan#130
@ericrallen
Copy link

@somewhatabstract It seems that this one wasn't automatically closed when PR #132 was merged in, I think it can be safely closed now.

@sampart
Copy link
Author

sampart commented Mar 21, 2019

Thanks for fixing this!

@sampart sampart closed this as completed Mar 21, 2019
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