Automattic/jetpack — pull request #511 by pdclark (2014-05-03 02:13:12+00:00)
Title: Resolve cross-domain error causing infinite-scroll to fail on HTTPS

Safari on Desktop and iOS consider HTTPS to HTTP requests as cross-domain.
So, for example, if a site is accessed via HTTPS on iOS Safari, infinite scroll will fail.

This bug affects many more users on wordpress.com, where all logged-in users
are switched to HTTPS.

The issue is resolved by checking the current protocol in infinity.js,
then switching http:// out for https:// in ajaxurl if needed.

This method is preferred over changing ajaxurl on the PHP side, beceause
server-side caching may cause protocol detection to be unreliable.

Video of bug in action: https://www.youtube.com/watch?v=253litAe1sg