Web Analytics Made Easy -
StatCounter Error Script - CodingForum

Announcement

Collapse
No announcement yet.

Error Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error Script

    Look At This:

    function reportError(msg,url,line) {
    var str = "<center>Err: " + msg + "<br>on line: "
    + line + "<br>URL: " + url + "<br>Web: "
    + navigator.appName + "<br>" + navigator.appName
    + "<BR>" + navigator.appVersion + "</center>";
    pop = window.open("","","width=400,height=400");
    pop.document.write(str)
    return true;
    }
    window.onerror = reportError;

    tim

  • #2
    cool that could be used in conjuction with a form to help debug your website.
    very neat.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

    Comment


    • #3
      Arn't i the best ;-) (CLUE)

      Comment


      • #4
        Cool.....but how does the script pass the arguments onError?
        Scripting | JavaScripts | PerlScripts | Python Scripts | Articles | My Journal

        Comment


        • #5
          The onerror event is in so far special that it automatically passes these three arguments to any handler function defined for that event.
          De gustibus non est disputandum.

          Comment


          • #6
            That is ABSOLUTLY correct!

            I love this script. If you combine it with a 'e-mail' script. (IE Sambar Server ect.) you can send the error streight to your inbox!

            Comment


            • #7
              i've actually done that on my site. for me, it's useful, because i have no traffic whatsoever, and it's not a lot of emails to get.

              but if you have lots of traffic, and there's a little tiny javascript problem somewhere, then you'll suddenly have a whole bunch of emails in your mailbox
              bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

              i am a loser geek, crazy with an evil streak,
              yes i do believe there is a violent thing inside of me.

              Comment


              • #8
                arrrrrrrr,

                That makes my 12YO soul happy

                Comment


                • #9
                  Umm, wrong forum. This belongs in the Post a Javascript category.

                  BTW, if you want to make it really good, look into the individual error properties.

                  For example, thanks to resident moderator Alex Vincent, relatively recent Gecko builds (includes NS7, maybe latest NS6) include a "stack" property of an Error() object, which is basically a stack trace. Very useful in debugging.
                  jasonkarldavis.com

                  Comment


                  • #10
                    Originally posted by joh6nn
                    i've actually done that on my site. for me, it's useful, because i have no traffic whatsoever, and it's not a lot of emails to get.

                    but if you have lots of traffic, and there's a little tiny javascript problem somewhere, then you'll suddenly have a whole bunch of emails in your mailbox
                    I am mainly an ASP (vbscript) programmer so javascript isn't my strong suit. How would one have the page send an email on error?

                    Thanks in advance,
                    Michael

                    Comment


                    • #11
                      you set up a server side script that sends email, and a page with a form. you use the error function to copy the important information to the form, and then javascript has a submit() method for forms. so you can use javascript to send the form, which then sends you all of the information from your javascript errors. i also have it set up to fire when i have a 404 error, or a server error
                      bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

                      i am a loser geek, crazy with an evil streak,
                      yes i do believe there is a violent thing inside of me.

                      Comment


                      • #12
                        Originally posted by jkd
                        For example, thanks to resident moderator Alex Vincent, relatively recent Gecko builds (includes NS7, maybe latest NS6) include a "stack" property of an Error() object, which is basically a stack trace. Very useful in debugging.
                        Sorry, not in NS6.2. It will be in NS7.
                        "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
                        June 30, 2001
                        author, ES-Membrane project (Github Pages site)
                        author, Verbosio prototype XML Editor
                        author, JavaScript Developer's Dictionary
                        https://alexvincent.us/blog

                        Comment

                        Working...
                        X