Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Loading a javascript site-wide

    var cot_loc0=(window.location.protocol...
    Typo in previous post, sorry.

  2. #2
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Loading a javascript site-wide

    For the <a>, I believe you have to put in in your code, just some where in your template code.
    Or you can write a piece of code that append that to an element on your page '<a href="http://www.instantssl.com" id="comodoTL">SSL</a>'

    I would go for the 1st choice since it's easier

    For the second part, I never tried the body_onload but I dont think you need to put the script tag there if the file is .js. You only have to put the script tag if the file is .php (you can put .php files in the jscript folder)
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #3
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Loading a javascript site-wide

    Quote Originally Posted by yellow1912 View Post
    For the <a>, I believe you have to put in in your code, just some where in your template code.
    Or you can write a piece of code that append that to an element on your page '<a href="http://www.instantssl.com" id="comodoTL">SSL</a>'
    I would go for the 1st choice since it's easier
    For the second part, I never tried the body_onload but I dont think you need to put the script tag there if the file is .js. You only have to put the script tag if the file is .php (you can put .php files in the jscript folder)
    Hey yellow,
    Thanks indeed for quick answer.
    Don't want to pester you very much.
    Just a couple q.:
    I know it would be easier to just hack the files as has been done so far, I did it myself and it works, but it doesn't look good and makes upgrades more difficult.
    The whole point is to leave them files alone.
    -------------------------------------
    Or you can write a piece of code that append that to an element on your page '<a href="http://www.instantssl.com" id="comodoTL">SSL</a>'
    -------------------------------------
    How would I append that anchor tag?
    What would be the syntax?
    I cannot use document.write()...
    Regarding the second issue, will try it both ways.
    Probably you are right and no script tags are needed.
    It's testing time!

  4. #4
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Loading a javascript site-wide

    When you edit the template file, it is not considered hacking in the code (obviously you do have to edit those files to change your template anyway).

    The reason why I did not give the specific code because such code can have unexpected behavior on different browsers, so I usually do it using jquery or some other frameworks (which take care of the compatibility issue for me)

    Also, after looking closely at your code, you may not even have to put it in the body onload, you can put that whole thing at the bottom of your page as well.

    Code:
    <a href="http://www.instantssl.com" id="comodoTL">SSL</a>
    <script language="JavaScript" type="text/javascript">
    COT("images/cornertrust.gif", "SC2", "none");
    </script>
    Some may argue that it's not good to do so, but if you have GoogleAnalytics or AdSense on your page you do the same thing anyway.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  5. #5
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Loading a javascript site-wide

    Yes, yes, that's the way it's been working.
    And, yes, you do have to modify template files, that's not hacking.
    It's just the javascripts that can be loaded dynamically, the wiki explains that in detail.
    It can be done site-wide (header and body), and even page per page.
    You may object that there is no need to fix something that works.
    I kinda agree, it's just a "good practice" issue, recommended by DrByte.
    Oh well, I'll have to review my javascript books and do some more research.
    I do appreciate greatly your dedication.
    Thank you so much and Happy Holidays!

  6. #6
    Join Date
    Feb 2007
    Location
    South Florida, USA
    Posts
    1,374
    Plugin Contributions
    4

    Default Re: Loading a javascript site-wide

    Since I am not sure about the anchor, left it as is in the common tpl_main_page.php
    The javascript I put in includes/templates/CUSTOM/jscript/on_load/on_load_comodocorner.js, without the script tags.
    It didn't work.
    However, it did work if I put it back in the template, with the script tags.
    I am testing on a local demo site, without any other mods installed.
    Any developer listening? DrByte?

 

 

Similar Threads

  1. Javascript not loading on Checkout pages
    By tcarden in forum General Questions
    Replies: 3
    Last Post: 25 Mar 2014, 06:43 PM
  2. Implement site wide javascript
    By usr50 in forum General Questions
    Replies: 7
    Last Post: 26 Feb 2011, 03:50 AM
  3. Half Frozen loading stuck site with text only loading
    By Zellcorp in forum Installing on a Windows Server
    Replies: 5
    Last Post: 1 Nov 2009, 09:16 AM
  4. Loading javascript files - prototip
    By guls_guys in forum General Questions
    Replies: 1
    Last Post: 19 Jun 2008, 12:40 PM
  5. Site Wide Javascript
    By traders in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 18 Nov 2007, 03:03 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