JavaScript error using windows.onerror in Mozilla and Firefo

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
fletchsod
Advanced
Advanced
Posts: 24
Joined: Tue Dec 21, 2004 6:52 pm

JavaScript error using windows.onerror in Mozilla and Firefo

Post by fletchsod »

When I placed the window.onerror on all web pages for the website before purchasing Milonic. I noticed an increases in javascript error with Mozilla and Firefox.

Andy on the tech support ticket said Milonic scriptswasn't loaded fast enough and he'll have to think of something. I know Andy will find a way in time to come.

Now a few weeks later, I decided to see if there is something I can do about it because I can not wait 6 months or something for a solution, so I'm interesting in hearing what workaround you think can be done until then. I'm open to any ideas or thoughts...

Upon studying the Milonic codes, I found that some functions, variables or arrays were called before it get defined which explained most of the javascript error I got. It remind me of the BASIC language when you use the GOTO looping syntax. So, that make workaround get pretty tough. A rule of thumb is to defined them all before using them. I understand that Gecko browsers executed the codes more quickly than IE, so some get called prematurely but maybe this is not the case here.

I discovered that if I hide the window.onerror, it worked like a charm and the Milonic functionality worked great. It's like nothing is broken. So, that bring me a problem which is that I can't hide the window.onerror because it is needed for things beside the Milonic script. So, I run the JavaScript Console and kept playing around. I found that the webpage never get a javascript error with the Console running. I find that odd too. (with window.onerror activated).

I am wondering if those are possible....

1) Suppress the Milonic errors but accept non-Milonic errors?
2) Rearrange the Milonic codes? This wouldn't make sense because it worked fine without the window.onerror.
3) Delay timer of some sort to prevent the popup() from activating while loading.
4) I dunno what else...

Thanks,
FletchSOD
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi fletchsod,

I'm just about to knock-off for the evening, it's almost midnight here now but before I go.... been thinking about your problem.

Anyway, I guess, what we could do is maybe declare a function that runs window.onerror(blah blah blah) but only declare this after the page has finished loading.

In other words, put the window.onerror function in the document.body.onload event. At least that way, the errors for Gecko browsers will be pushed to the JavaScript console rather than to a new page, does this sound feasible?

Food for thought at least - I'm outa here for the night so speak to you tomorrow

Cheers,
Andy
fletchsod
Advanced
Advanced
Posts: 24
Joined: Tue Dec 21, 2004 6:52 pm

..

Post by fletchsod »

Not bad, I'll give this a try on the sample website and see what happen. Will let you all know then...

FletchSOD
fletchsod
Advanced
Advanced
Posts: 24
Joined: Tue Dec 21, 2004 6:52 pm

Nope...

Post by fletchsod »

Nope that doesn't work. It's a good try. Again, I feel not sure if it is something I would want to do because it could prevent non-Milonic scripts from running into an error too. Right now, the browser had crashed after I repeatly tested the script. :roll: :roll:

So, I lost some of the tabbed websites. I'll just fire-up both Firefox and Mozilla and have Firefox to the webs for anything and use Mozilla for script testing for now until then.

Saw in a different forum that someone asked me to try the "try/catch/finally" method. Um, not sure if that can be done...

FletchSOD
fletchsod
Advanced
Advanced
Posts: 24
Joined: Tue Dec 21, 2004 6:52 pm

Anyone??

Post by fletchsod »

What's the javascript commands for the sleep event? I'm going to put it into the pop_up() function and see how much of a help will it be.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: Anyone??

Post by kevin3442 »

fletchsod wrote:What's the javascript commands for the sleep event? I'm going to put it into the pop_up() function and see how much of a help will it be.
So far as I know, there isn't a js equivalent to sleep. But you might try the js method called setTimeout(). You use it to run a specified function after a specified amount of time (in msecs) following the call to setTimeout(). You'll find documentation here.

Without reviewing all of the earlier issues, I'm not sure what you're going for (been out of the forums for a while). However, some time ago, I wrote a small set of functions for someone who wanted to wait until a menu (the main menu I think) had appeared before doing other things on the page. Don't know if that'll help, but it at least demonstrates one use of setTimeout(). You'll find the discussion here.

Cheers,

Kevin
fletchsod
Advanced
Advanced
Posts: 24
Joined: Tue Dec 21, 2004 6:52 pm

..

Post by fletchsod »

Thanks.. I'll give this a try once I finish up other open items. I have put this Milonic menus on the back burner for now because it's hard for me to have time for everything. I'll let you know how it goes when I get back to it...

FletchSOD
Post Reply