jdan/tota11y

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

Closed this issue · 2 comments

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!

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

Thanks for fixing this!