Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts

    Enable script errors in IE

    My work seems to have locked me out of the advanced tab in IE, so I can't enable script errors. Every now and again it will still prompt me with an error and I can click the checkbox to always provide notification. I can't for the life of me though, figure out what I am doing for it to throw the error, it seems random. If anyone knows or if they know of another way to enable the error reporting it'd be swell.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Well, there are a number of practical things. If it's an iew specific error, your best shot is probably to use the Microsoft Script Debugger.

    Another solution that only works for cross browser errors is to use the excellent debuging facilities of moz. JavaScript Console, enabling strict warnings, using Venkman (the JavaScript Debugger), the DOM inspector and the error tracing features in the native objects provide the best platform for bug tracking you can find.

    Op7, if you enable displaying errors in the JavaScript Console, is excellent for tracing errors related to events and event handling, though it in other areas is not quite as good as the moz JavaScript Console. Op7 has the benefit of being closer to iew than moz is, when it comes to host environment.

    Then there are the source code tricks you can use. The most efficient is to insert try..catch statements in the code, and alerting/prompting values for inspection to follow the runtime environment. There are of course cruder things you can use as well.

    (Hmm, I kinda recall posting about JavaScript debugging this in the FAQ some time back, maybe you should check there.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,734
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts

    Question

    "There are of course cruder things you can use as well."

    More details, please!

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Well, how about using the address bar for inserting 'javascript:' pseudo URIs for inspecting the runtime, using the window.onerror event, or just filling your script with alerts, confirms and prompts? Neither is as useful as the detect-and-handle approach of try..catch and well placed inspection if-statements for the non-error bug detection. Onerrror doesn't allow locally specific handling in the way try..catch do. etc.

    I listed the tricks I think are most useful.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Indeed, I see where you are coming from, and appreciate the advice but I can't install any additional software. With all due respect I wasn't asking about the best ways to debug a script or alternativesto IE, I was asking what I can due in my code to throw the error in IE even if the script errors are off, so that I can turn it back on by clicking the always display the errors checkbox. Somtimes if I just throw in a random quote mark or somthing it will pop up anyhow. If noone knows that's cool. I can muddle through.

    Basscyst
    Last edited by Basscyst; 11-01-2004 at 11:57 PM.
    Helping to build a bigger box. - Adam Matthews

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Noting your inability to alter the working environment, as Liorean pointed out the most efficient way to catch errors is using the try { ... normal code here ...} catch (errorInformation) {... error handling code here...} construct. If you wrap an entire function in a try block then any errors in that function will be passed to the catch block. The variable "errorInformation" is the error object and you can display the error using an alert.

    Code:
    function flaky()
         {
          try
               {
                // Some code that may generate errors
                }
           catch (theError)
                {
                 alert(theError.message) 
                 }
           }
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #7
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Thanks Roy, I see how it works. That helps a bit, I usually use an alert to narrow down the area the error is occuring. At least now I can see why the error is occuring. Still more time consuming then just having it tell me what line the error is on (or around at least, IE error reporting does still suck). I really just needed the example, I understand now.

    Thanks,
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #8
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    477
    Thanks
    0
    Thanked 51 Times in 50 Posts
    Of course there's the obvious. If the script you are working on is for work, you should inform your supervisor or IT dept. that the "standard practices" are keeping you from efficiently completing your job. Given the highly technical aspect of your job, they should at least consider turning on IE's script error dialog for your installation so that you can continue writing quality scripts.

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by kansel
    Of course there's the obvious. If the script you are working on is for work, you should inform your supervisor or IT dept. that the "standard practices" are keeping you from efficiently completing your job. Given the highly technical aspect of your job, they should at least consider turning on IE's script error dialog for your installation so that you can continue writing quality scripts.
    If they're half as head-blind as the people in charge of security where I work he's got next to no chance of making that happen. One size never fits all but you can't convince some people of that.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •