You can get the url through the Browser expression "url". From there, you could check that the first characters are either "http:" or "https".
Indeed, for AJAX to work on SSL
, the page from where the call is made and the target page must both be https.
I didn't know about the https to http not working, it makes no real sense to me.
Another thing to take into account is cross-domain incompatibilities.
Your ajax call has to be made from the same domain as the target. (to confirm)