AddThis and JavaScript with site build

Discussion in 'Software' started by sevenismagic, Aug 2, 2011.

  1. sevenismagic

    sevenismagic Private First Class

    Hola!

    I am no programmer - that is fo' sho'. But I'm building a site anyway!

    I'm using the AddThis API instead of building my own (still not a programmer), but I wondered if I need to put the entire giant JavaScript into each page I put the buttons on or if the other pages will "magically?" get the code from the index page. I have yet to encounter magic during this endeavor, but if it's there, I'm all about it!

    I'm thinking I need to put it on each page the buttons are on, but it's starting to make the code look like a giant mess. That much I do know about programming - code shouldn't look like scrambled eggs. :major

    OK. I attached the code. This is the thing that makes me think they are seperate. There is notation "start addthis" and "end addthis" twice.
     

    Attached Files:

    Last edited: Aug 2, 2011
  2. PC-XT

    PC-XT Master Sergeant

    I didn't really look that hard, but you probably only need one script tag at the end of the code on each page. You will need it on each page with those buttons. It shouldn't matter much from the browser's point of view, since the cache should load it only for the first tag on the first page, then reuse it for the other places the same script tag appears, including other pages with the same tag, only reloading it if it's updated on the server.

    If it makes the code look better, I'd try removing all but the last script tag on each page, if they are all the same, to see if it works.
     
    Last edited: Aug 3, 2011

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds