WSN
JavaScript Issues
JavaScript Issues
By
10/16/04 (Edited 06/26/11)

Occasionally, due to how the script manipulates characters, you may find that some JavaScript you wish to use doesn't work when you put it in the template. To work around this, make it an external javascript. Take the opening and closing <script> tags off and save the rest of your script as yourname.js, then upload the yourname.js file to yoururl.com. Then go to Admin Panel -> Templates -> Manage Templates -> "Wrapper" and insert <script language="JavaScript" src="http://www.yoururl.com/yourname.js" /> somewhere between <head> and </head>, assuming it's javascript that needs to go in the header (if it's not, put it in whatever template you need it in).

Important Note For jQuery Users

If the javascript files you're inserting depend on jQuery, you'll need to paste the <script ...> tags into jquery/morejavascript.txt instead of the wrapper template, so that they get autoinserted in the right spot after all the jquery stuff is autoinserted.

More Troubleshooting

If you're having trouble and you're sure your javascript is ok:
1) Check what libraries your javascript is using. For example, if it's using mootools or prototype you may need to insert compatibility code to make those play nice with WSN's jQuery. If you're using jQuery, then remove the spots where your javascript loads jQuery and just have it use WSN's jQuery (again, it'll need to be called in jquery/morejavascript.txt then).
2) There could be a function name conflict -- your file using the same function name as WSN already uses.
Details Print Rate Report E-Mail


4/5 based on 3 votes. The median rating is 5.

Views: 1450 views. Averaging 0 views per day.

Previous Article | Next Article

Features Showcase Reviews Purchase Services Resources Support