DOWNLOADS EXAMPLES SKINS DOCS SUPPORT
 
 

Javascript Controls - Troubleshooting

This page contains explanations to help overcome some of the most common pitfalls to working with Javascript and HTML.

Real World Usage

When using Wimpy in the "real world" all references to all files associated with Wimpy should be full URL's. Because Rave was designed to work on a web server, not a local PC.

Although "relative" URLs can be used, we highly recommend using full URL's or "absolute" paths to files. Flash is a little tricky with how it determines it's relationship to other files. In a nut shell, SWF files "take on" the location of the HTML file that it is embedded in.

Using full URLs will eliminate many hours of frustration.

For example, in this documentation we may reference a single file as:

<script language="JavaScript" >
      makeWimpyPlayer("example3.flv");
</script>

When you go to test out Wimpy on your web site, you should use something similar to:

<script language="JavaScript" >
      makeWimpyPlayer("http://www.yousrsite.com/path/to/example3.flv");
</script>

Using a full URL will enable you to move HTML snippets around from page to page on your site, without having to re-edit the HTML code to set the proper path.

Click here for more information on using "relative" paths (e.g. "../../file.xyz" ).

 

Verifying URLs

It is a good idea to test a URL before using it. Usually, I copy and paste the URL into a new browser window's address field to make sure that i'm "hitting" the right file. (Sometimes my typing can be terrible.)

 

Clear Browser's Cache

Clearing your browser's cache ensures that your browser loads the latest changes to any files that were edited. Click here to lean how to clear your browser's cache.

For development I highly recommend Mozilla's Firefox browser. The primary reason is because FireFox's "Clear Cache Now" button actually works. Internet Explorer does not always clear files from the cache, which causes many hours of double thinking where the code is wrong. With FireFox, you KNOW that the cache is cleared when you "Clear the cache." Plus there are a number of developer tools and extensions that make clearing the cache 9or disabling the cache a one click (or no-click) deal.

To clear the cache in FireFox, From the Main Menu > Tools > Options > Privacy Icon > Cache tab > "Clear Cache Now." You can also include the "clearing of the cache" by clicking the "settings" tab in the same screen and check "cache" from the list, This way you only have to From the Main menu > Tools > Clear Private Data. OR, ctrl+ shift+del.

In addition there is a nifty JavaScript error reporting tool, which can help you determine exactly where the JavaScript error is occurring. The JavaScript error console can be access From the Main Menu > Tools > JavaScript Console.

Nailing down the "Clear cache" and using the JavaScript Console will save you lots of time and headaches.

 

Weirdo Characters

It is best to try and only use alpha-numeric characters. Multi-byte (e.g. chinese characters) and non-alpha-numeric characters (e.g. ' ? & " etc.) may be problematic. You may want to apply the escape() function to any questionable arguments that may contain non-western / non-alpha-numeric characters.

Pay special attention to URL encode (escape) -- or don't use at all -- the following characters:
& ' ? space " # ! \

 

Single Quotes, Double Quotes

When referencing files, or including function calls within your HTML code, you can use 'single quotes' or "double quotes." There is no set rule, both will work.

The reason you would want to use one instead of the other is if the content contains one of the two.

Example:

Good:
"   '    "

Bad:
"   " : "

Example:

If you wanted to use a URL such as:
http://www.yoursite.com/bob's files/bob.jpg
.. where bob is plural

You would have to wrap the line with double quotes, because there is a single quote in the line. if we wrapped the URL with single quotes, then the browser will think that the ending quote is after bob.

Bad:
'http://www.yoursite.com/bob's files/bob.jpg'
Good:
"http://www.yoursite.com/bob's files/bob.jpg"

Likewise, if we wanted to use a double quote in the URL, we would have to wrap the URL with single quotes:

Bad:
"http://www.yoursite.com/bob said "hi" hello.jpg"
Good:
'http://www.yoursite.com/bob said "hi" hello.jpg'

I do not recommend ever using weirdo characters in any file name or folder name. Try and use only alpha-numeric characters.

The reason I went off on this long explanation is because sooner or later you are going to want to use a file with an apostrophe in your wasp code -- like when you try and reference an FLV video such as:

Bad:
waspPopup('bob's video.flv', 320, 240)
Good:
waspPopup("bob's video.flv", 320, 240)

It will invariably happen, and now you know why.

 

Choosing an HTML editor

We recommend using a "plain old" text editor  The simpler the text editor the better.

For Windows users Note Pad (notepad.exe) is a good choice. Note Pad is usually located here:
C:\WINDOWS\system32\notepad.exe

If your on a Mac, check out Smultron.

The reason we recommend using a regular text editor, as opposed to a big fancy HTML editor such as Dreamweaver, FrontPage or similar is because often times, these programs will re-write the HTML code, in the process of re-writing the HTML code, sometimes they will include un-necessary stuff, or eliminate certain stuff that Wimpy needs to operate properly. This can create serious headaches.

Do NOT use Microsoft Word (or similar) to edit the HTML code.

 

About Comments // <!--

Comments are lines within code that help programmers understand what certain parts of the code does. Comments are not processed by the browser, but are simply ignored -- so it's a nice way to include "human readable" explanations for how the script works within the code.

Programmers will often use the following terminology:
"Comment out that line."
and
"Put some comments in that code."

Interpreted for non-programmers:
"We don't want to delete that line (because we may need it later) so just put two slashes in front of it so that that line of code won't get processed, which is the next best thing to deleting the line."
and
"It would be nice to have a little explanation of what each part of the code does so that I can better understand it, and perhaps make some modifications to it to suit my needs better (or correct your bugs :)"

HTML comments

In HTML, comments are "chunks" of code that start with <!-- and end with -->

Greater-than-exclaimation-dash-dash followed by dash-dash-less-than.

When a browser sees <!-- it skips reading and interpreting HTML code until it reaches -->

This enables HTML authors to include "human readable" messages within the context of the HTML code so that anyone who reads the source HTML code can get a better understanding of what certain portions of the code are used for.

Example:

<!-- The following will render a text-based hyperlink to Google-->
<a href="http:// www.google.com">Go to Google</a>

 

 

JavaScript Comments

In JavaScript, comments are lines that begin with two slashes //.

Example:

// myVariable will be used to identify my pet fish's name.
myVariable = "bob";

Notice that these are forward slashes, not backward slashes. If you use backward slashes, you will break the code. Lines that begin with two forward slashes are NOT processed, they are ignored when the JavaScript engine ("Interpreter") processes the script. You can also use a slash-star pair to comment out a large block..

Example:

/*
myVariable will
be used to identify
my pet fish's name.
*/

myVariable = "bob";

 

 

 

 

 

 

 

 

  ©Copyright Plaino LLC. All rights reserved.