Jump to content
Sign In to follow this  
whatabrain

This site has a ton of JavaScript errors!

17 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online: A long, long time ago... 
 

This site has a truly ridiculous number of JavaScript errors. I ran into ten or so error pop-ups on the home page and during the regisration and sign-in process. The developers should enable JavaScript error reporting in their browsers and run through the site. These errors are usually very easy to fix.

Edit: Just to clear things up for new readers of this post, the error occurs when you hover your mouse over the log-in area. It's caused by a JavaScript function not existing in the scope of the page. And I'm not referring to pop-up ads. These are JavaScript errors, which pop up in MS Internet Explorer when your settings are configured the right way.

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

The only errors I have encountered when I run the JavaScript console on Firefox are several CSS declarations that has been dropped. I have not encountered a single JavaScript error, and from careful inspection of the site code I cannot immediately put my finger on a single one. What browser are you using? And what are the errors in particular?

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

I'm not getting any JavaScript errors that you are talking about. Pop-ups?!?! I'm not sure what to say... What type of pop-ups?


Software developer. University of Houston. CBRE.

Share this post


Link to post
Share on other sites
Posted:
Last Online: A long, long time ago... 
 

well sounds like you have a security centre program of some sort that is blocking pop-ups on your computer....just a guess though...as ST has no actual pop-up ads on it ...it's ok to allow pop-up here...actuall you will need to this as most of the sites sections are set up to act  pop-up windows to get to the downloads...thier not ads but security centre may block them thinking they are...but the actaully the files  themselves....without allowing pop-up on ST....you won't be able to use the STEX or mods download section correctly

as for java errors...check  your java account...you might be a little behind in the updates and this could also contribute to problems on simtropolis

try those two things...see if things improve...4.gif

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    I wasn't referring to pop-up ads. In Internet Explorer, if you enable javascript errors, you get a pop-up message for each error.

    The problem is simple: The sign-in region on the home page has an onmouseover event which calls ftcontexthelp(). This function doesn't exist in the HTML. I assume it's defined in "wz_tooltip.js" (which, by the way, is included twice). When I tried to access that file directly, it didn't exist.

    So every time you move your mouse over the sign-in area, you get a JavaScript error.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I guess that we all should have those errors as well, but I wonder why we don't. 2.gif

    One tip, update your java software.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    This has nothing to do with Java. This is JavaScript, which is a totally different thing, dispite the name.

    Here's why you don't see the errors: Knowing that bad JavaScript code can be found on all sorts of web sites, browsers hide JavaScript errors by default. Since I write JavaScript code, I want to know when errors occur. They always indicate that something's not working. So in my IE "advanced" settings, I check the box that says "Display a notification about every script error." In FireFox and other Mozilla-based browsers, I open the JavaScript console.

    Now if you're using IE, and you hover your mouse over the "log-in" region, you may notice that the icon on the left side of your status bar changes to an error icon. Double-clicking on the icon will show you the JavaScript error that your settings hid.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    Just found another error, on the "Modds" page. The following code is incorrect:

    escape('<strong>Trolca's Street Modd</strong> by Trolca (13,364 downloads)')

    The single-quote in "Trolca's" should be escaped:

    escape('<strong>Trolca\'s Street Modd</strong> by Trolca (13,364 downloads)')

    In general, when generating JavaScript code like this, care should be taken to escape quotes and backslashes. If you're using perl, php, or any other language that supports regular expressions, the following expression will correct embedded JavaScript:

    s/([\'\"\\])/\\$1/g;

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     

    I have been writing JavaScript, Perl/CGI, PHP, Java, C/C++, HTML, CSS etc., for years and years and it is perfectly acceptable to leave a single quotation mark within an expression provided that expression is enclosed within double quotes. Therefore, "Trolca's Street Modd by Trolca (13,364 downloads)" would perfectly acceptable and would validate correctly. Only if the expression is single quote enclosed does any apostrophe need to be escaped. I haven't checked the code on this site very closely, and it may well be that in this example you are correct, but I thought it best to give the balanced view here.

    As far as the JavaScript errors you are seeing, I cannot find any of them using the Firefos JavaScript console. What version of IE are you using? It is a well known fact that IE6 is very very very buggy with regard to some of it's code handling, and it may wel be that the double include of a js file is throwing up a bug as IE may not accept the double include whereas Firefox, being far more forgiving, does accept it.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    whatabrain; are you volunteering your services to debug the code used on this website? if so I would recommend dropping a post to Dirk, I am sure he would be more than happy to accept any free coding expertise that he can get.

    If no, and you are just "picking at the coding because you have nothing better to do", I simply suggest you remember this site is provided for free, and everyone associated with its maintanence and upkeep are doing so in their free time and as such, you should not expect "perfect code everytime" unlike game manufacturers (who you pay) get it right out of the box everytime (sarcasm!).

    Just my 2 cents.....

    (Thanx Dirk for everything you do!) 

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     

    Well said that man 9.gif And, of course we are all blessed with the wonders of a bug free operating system ... and the joys of yet another XP BSOD simply because I didn't reboot after a new installation! And the joys of a bug free internet experience using Windows IE - which is why I use Firefox!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Actually when i opened the javascript console in firefox it displays various erorrs in the simtropolis site including an error about ftcontexthelp. But as long as the site keeps working normally i don't think these errors are a problem.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I thought I heard the site has a ton of errors when viewed in IE? Could this be the cause?


    Known as Kitsune on sc4e. NAM Team Member.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Just as a mere info to anyone that says this is Java errors, yesterday I've tried an old PC with windowns ME, little software installed, and I loaded the IE and when passing the mouse over the login windows, that pop-ud window with a message error appered. I couldn't login, so, I went to www.java.com/getjava/ and updated my Java software automatically, and after restarting the PC, I could log in without a single error. What about that?

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     

    it is perfectly acceptable to leave a single quotation mark within an expression provided that expression is enclosed within double quotes.quote>

    You're right, of course. However, since this is in an HTML attribute, either the single or double quotes have to be escaped. I find that the easiest and least bug-prone method is to always escape single quotes, double quotes and backslashes in generated JavaScript strings. While not absolutely necessary, it prevents problems when you later decide to change the style of quoting you use.

    In this case, we have a single-quoted string which contains single-quotes. That's what causes the problem.

    It is a well known fact that IE6 is very very very buggy with regard to some of it's code handlingquote>

    Not sure where you're getting this. I've also been coding in JavaScript for quite a few years, and I've found that while IE has some problems (rendering and DOM manipulation speed are its biggest), it's the least buggy browser out there. People brag about how well Mozilla conforms to the specs, but from what I've seen, all versions of Mozilla, Netscape and FireFox have some serious bugs when it comes to more complex DOM manipulation, and due to those bugs, conform less well than IE. Safari is much worse than Mozilla. IE 5.0 had a lot of problems, but they've cleaned them up for 6.0.

    I couldn't login, so, I went to www.java.com/getjava/ and updated my Java software automatically, and after restarting the PC, I could log in without a single error. What about that? quote>

    Sounds like your Java installation automatically turned off the setting which allows JavaScript errors to pop up. It didn't fix the problem -- just hid it.

    If no, and you are just "picking at the coding because you have nothing better to do", I simply suggest you remember this site is provided for free.quote>

    I'm picking at the coding because I find JavaScript errors annoying. However, I'm not just picking at it. As you can see in my posts, I've also identified the offending lines of code and offered simple solutions to the problems.

    I wasn't aware that contacting the site's creator was the way to get these kinds of things fixed. I figured this forum was the way to do it, and would be less annoying to him. However, I'd be happy to write up some quick bug fixes for the site if he's interested.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     

    I just wanted to say that this is very nice of you. I think most people just ignore these errors (at least I do) because we don't know how to debug them. Especially since this site is run for free we need volunteers. It's admirable that skilled developers take their time to volunteer like this.

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections