[openstreetmap-website] code simplification for https assets (#700)

Holger Jeromin notifications at github.com
Wed Feb 12 12:02:57 UTC 2014


Right not we have 

        url: document.location.protocol === 'https:' ?
      'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' :
      'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',

This could be shorter as

    url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',

(note the // in front) and the browsers will use the same protocol as the page was transported.
http://www.paulirish.com/2010/the-protocol-relative-url/

Perhaps this is useful for other places in the website code (especially if there is no JS involved).

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/700
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20140212/ff06cda9/attachment.html>


More information about the rails-dev mailing list