Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default magic function for linking to http vs https as necessary?

    In a template file, if I am using an external resource, say Google's fonts... and I'm on an https page it complains about loading an insecure resource. I can hardcode it to https no problem. But I figure there must be a way for ZC to know whether the current page is http or https and then load the resource similarly?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: magic function for linking to http vs https as necessary?

    Quote Originally Posted by s_mack View Post
    In a template file, if I am using an external resource, say Google's fonts... and I'm on an https page it complains about loading an insecure resource. I can hardcode it to https no problem. But I figure there must be a way for ZC to know whether the current page is http or https and then load the resource similarly?
    It's not a ZC thing for referencing external sites using the method from which a page is offered. It's actually believe it or not a browser thing.

    There is a standard by which browsers are to be written and recognize web page addresses. For some links, that include the a href link, if you simply set the link address as "//servername/folder/file" the file found at that location will be accessed using the https: or http: of the page on which the link is provided... So, in your case: "//google.com/fonts/blah/blah.fnt" would access https://google.com/fonts/blah/blah.fnt when the link is presented on a secure page.

    There are exceptions to this, meaning ftp doesn't work this way, and there are a few others. I forget the reference that specifically must be met, but all "modern" browsers are expected to meet this requirement.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: magic function for linking to http vs https as necessary?

    Yet another thing I knew and forgot. I hate getting older. Thanks

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: magic function for linking to http vs https as necessary?

    Quote Originally Posted by s_mack View Post
    Yet another thing I knew and forgot. I hate getting older. Thanks

    Only getting wiser... :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 9
    Last Post: 25 Jul 2014, 01:55 AM
  2. http vs https
    By jaishem in forum General Questions
    Replies: 2
    Last Post: 23 May 2011, 04:56 PM
  3. Is it normal for https to be annoyingly slower than http?
    By cochlear in forum General Questions
    Replies: 5
    Last Post: 6 May 2008, 01:31 PM
  4. Necessary to Duplicate File Structure in http *and* https?
    By dsdavis in forum Installing on a Linux/Unix Server
    Replies: 5
    Last Post: 29 Feb 2008, 11:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg