Design and CSS styles
Version 5.x > Design and CSS styles > Uploading external .js files View modes: 
User avatar
Member
Member
regina.chou-ntfund - 9/19/2010 11:09:24 PM
   
Uploading external .js files
Hi, I'm trying to implement the Accordion content script on a webpage which requires uploading 2 external files to the same directory as where the webpage resides, could someone please advise me how to do that? Thanks a lot, Regina

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 9/20/2010 5:01:50 AM
   
RE:Uploading external .js files
Hello,

Regrettably, we don't have any experience with this functionality. In general, a good placement for the javascript code could be the App_Themes\YourSite folder, with css styles, if it's related to styling, or you could also use 'CMSTemplates\YourSite\JS' or 'CMSTemplates\JS\', etc., it depends on the usage (common for multiple sites, single site..., different sites).

Best regards,
Boris Pocatko

User avatar
Member
Member
batchahaja-socpa.org - 4/15/2012 9:07:55 AM
   
RE:Uploading external .js files
Can you tell me whats the best way to link it. we are using kentico version 6.0

I copied external jQuery and Jscript files to the CMSTemplates folder and given the link as below

<script type='text/javascript' src='~/CMSTemplates/diapo.js'></script>

on Edit template properties > Header on the box below
Add HEAD element content:

Its not working, please tell us a right way of doing it

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/17/2012 9:45:27 AM
   
RE:Uploading external .js files
Hello,

Could you please let me know if the link in the HTML source of the live page is generated correctly?

Best regards,
Boris Pocatko

User avatar
Member
Member
batchahaja-socpa.org - 4/18/2012 1:20:17 AM
   
RE:Uploading external .js files
Hi
Later i removed the link from header section and paste it on
Edit page template > Layout
on the top of the layout like below
<script type='text/javascript' src='~/CMSTemplates/diapo.js'></script>

<script>
jQuery(function () {
jQuery('.pix_diapo').diapo();
});

</script>

Now its working on the desing time, when i click on the live site. Its not working.

Thanks for your reply

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/19/2012 8:36:44 AM
   
RE:Uploading external .js files
Hello,

Please make sure there are no conflicts in your javascript by using the approach mentioned in this FAQ.

Best regards,
Boris Pocatko

User avatar
Member
Member
ahmed.hassan-dream-makers - 10/21/2010 6:34:00 AM
   
RE:Uploading external .js files
You can do it externally by uploading the 2 JS files using the FTP and use there absolute paths in your masterpage e.g. http://yourdomain.com/js/jsfilename.js

It worked for me for more than one JS script e.g. Lightbox, Accordion smiliar