Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

External JS and CSS files

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-25-2013, 06:56 AM
  websupport's Avatar 
websupport websupport is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 32
 

Default 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?
__________________
Sizzle Factor @ www.sizzlefactor.com
Simply X-Cart @ www.simplyxcart.com
VitalBGS @ www.vitalbgs.com
For all of your X-Cart solutions!
X-Cart versions 4.4.0 to 5.0
Reply With Quote
  #2  
Old 09-25-2013, 06:58 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default 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.
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #3  
Old 09-25-2013, 07:34 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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}.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #4  
Old 09-25-2013, 08:54 AM
  websupport's Avatar 
websupport websupport is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 32
 

Default 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).
__________________
Sizzle Factor @ www.sizzlefactor.com
Simply X-Cart @ www.simplyxcart.com
VitalBGS @ www.vitalbgs.com
For all of your X-Cart solutions!
X-Cart versions 4.4.0 to 5.0
Reply With Quote
  #5  
Old 09-25-2013, 09:07 AM
  websupport's Avatar 
websupport websupport is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 32
 

Default 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.
__________________
Sizzle Factor @ www.sizzlefactor.com
Simply X-Cart @ www.simplyxcart.com
VitalBGS @ www.vitalbgs.com
For all of your X-Cart solutions!
X-Cart versions 4.4.0 to 5.0
Reply With Quote
  #6  
Old 09-25-2013, 06:19 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #7  
Old 05-08-2019, 04:56 AM
 
sales@webosusa.com sales@webosusa.com is offline
 

Senior Member
  
Join Date: Nov 2007
Location: Australia
Posts: 118
 

Default Re: External JS and CSS files

This will sove your issue...
https://market.x-cart.com/addons/custom-header-assets.html
__________________
Pedro
digitalnotions.i2u.shop
shop.modestclassy.com.au4.1.9 X-Cart
X-Cart
Business 5.3.6.0
Multi-vendor 5.3.6.0


Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:40 PM.

   

 
X-Cart forums © 2001-2020