X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   External JS and CSS files (https://forum.x-cart.com/showthread.php?t=67826)

websupport 09-25-2013 06:56 AM

External JS and CSS files
 
I am having a problem with using an external javascript file for fonts from fonts.com. Every page that requires https connections (like login, register, and checkout), it doesn't auto load it but gives me warnings about unsafe scripts. How can I change that?

philrisk 09-25-2013 06:58 AM

Re: External JS and CSS files
 
Can you paste your code snippet so we can have a look. I had some issues with fonts not appearing but it just took a few tweaks to the code.

totaltec 09-25-2013 07:34 AM

Re: External JS and CSS files
 
I think this is beneath you but I'll ask:
Are you calling the JS file with http:// in the src?

If not then there must be something coming from fonts.com. Looks like there is no problem with ssl: http://www.fonts.com/support/faq/using-web-fonts-with-ssl

If you need to detect whether https is on in a template, I believe you can use {$current_protocol}.

websupport 09-25-2013 08:54 AM

Re: External JS and CSS files
 
Here is the tag from fonts.com:

<script type="text/javascript" src="http://fast.fonts.com/jsapi/9ed357a7-37b3-41b3-ac75-d34a18b65993.js"></script>


I have tried that in the head tags, I have tried it in the service_js.tpl file, but if I use this:

{load_defer file="http://fast.fonts.com/jsapi/9ed357a7-37b3-41b3-ac75-d34a18b65993.js" type="js"}

it does the same thing. It only does it on pages that are running secure (https).

websupport 09-25-2013 09:07 AM

Re: External JS and CSS files
 
Well I guess I wasn't paying attention when I put it in. Of course a https page won't display external content from http sources. It has to be https. I fixed it by changing it to https. So I have:

<script type="text/javascript" src="https://fast.fonts.com/jsapi/9ed357a7-37b3-41b3-ac75-d34a18b65993.js"></script>


And that is working now.

cherie 09-25-2013 06:19 PM

Re: External JS and CSS files
 
You should also be able to replace src="https://..." with src="//..." then it'll load using the page's protocol. This avoid unnecessarily loading secure (uncompressed) files on your non-secure pages.

sales@webosusa.com 05-08-2019 04:56 AM

Re: External JS and CSS files
 
This will sove your issue...
https://market.x-cart.com/addons/custom-header-assets.html


All times are GMT -8. The time now is 08:05 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.