jaymc Posted February 25, 2009 Share Posted February 25, 2009 A lot of my users (not all) get this IE alert when closing my website. The issue is, it does not give any indication to the function/line where the error is being triggered Any ideas how to debug this. I have about 2000 lines of javascript in 5 files... so not feasible to do this manually There is nothing wrong with LINE 1 or CHAR 1 and if I remove that line completely I still get the error [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/ Share on other sites More sharing options...
KevinM1 Posted February 25, 2009 Share Posted February 25, 2009 Unfortunately, your request is a bit vague. Is the error occurring with a certain version of IE? Do you have any code that's supposed to fire when the page is unloaded? Have you checked it with FireFox and FireBug? Can you generate the error yourself? Are you waiting to load the JS until after the HTML is fully rendered? Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-771261 Share on other sites More sharing options...
jaymc Posted February 26, 2009 Author Share Posted February 26, 2009 Is the error occurring with a certain version of IE? - IE6 and IE7 Do you have any code that's supposed to fire when the page is unloaded? NO Have you checked it with FireFox and FireBug? No ALERT error with firefox but I guess thats because this is an IE thing (alerting) Can you generate the error yourself? NO Are you waiting to load the JS until after the HTML is fully rendered? NO Im just wondering why IE says its on LINE1 CHAR1. Is that where I should be looking? Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-771488 Share on other sites More sharing options...
darkfreaks Posted February 26, 2009 Share Posted February 26, 2009 Edit: have you tried running your code through jslint? http://www.jslint.com/ Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-771492 Share on other sites More sharing options...
KevinM1 Posted February 26, 2009 Share Posted February 26, 2009 Are you waiting to load the JS until after the HTML is fully rendered? NO Without being able to see the code, this could be the root of the problem. You need to ensure that the HTML is fully rendered before attempting to obtain element references. If you're using a lot of inline JavaScript, then it won't be much of an issue as it's written at the same time as the markup. But if you have element references placed within <script> tags, they may be null because JavaScript is attempting to obtain the elements before they exist. So, something like: <script type="text/javascript"> window.onload = function() { /* script goes here */ } </script> May fix the issue. Again, this is without seeing any code, so there's definitely no guarantee that this will fix the issue. Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-771772 Share on other sites More sharing options...
jaymc Posted February 26, 2009 Author Share Posted February 26, 2009 Here I have this <script language="javascript" type="text/javascript"> var init_user = ""; var init_password = ""; </script> <script type="text/javascript">Drag.init(document.getElementById("draglol"));</script> <script type="text/javascript"> _uacct = "UA-272345490-1"; urchinTracker(); </script> Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-771983 Share on other sites More sharing options...
KevinM1 Posted February 26, 2009 Share Posted February 26, 2009 Unfortunately, that doesn't really shed any light on the problem. It looks like you have several 'islands' of JS in your code, but without seeing exactly where it's located in the document, and any code that provides context for what's going on, I can't really diagnose the problem. Is this JS something you wrote yourself, or is it a 3rd party script? Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772009 Share on other sites More sharing options...
darkfreaks Posted February 26, 2009 Share Posted February 26, 2009 its a 3rd party script from google ads it keeps telling me urchintracker is 'undefined' <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-9999999-9" if (typeof(urchinTracker) != 'undefined') urchinTracker(); </script> dont know if that will solve the problem Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772011 Share on other sites More sharing options...
jaymc Posted February 26, 2009 Author Share Posted February 26, 2009 Unfortunately, that doesn't really shed any light on the problem. It looks like you have several 'islands' of JS in your code, but without seeing exactly where it's located in the document, and any code that provides context for what's going on, I can't really diagnose the problem. Is this JS something you wrote yourself, or is it a 3rd party script? I wrote a lot of it but I use things like SwfFlashObject its a 3rd party script from google ads it keeps telling me urchintracker is 'undefined' <script type="text/javascript> var _uacct = "UA-9999999-9"; if (typeof(urchinTracker) != 'undefined'){ urchinTracker();} </script> dont know if that will solve the problem Thats fine urchinTracker() is refferenced further up in the code Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772017 Share on other sites More sharing options...
darkfreaks Posted February 26, 2009 Share Posted February 26, 2009 modded my code try it ??? Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772019 Share on other sites More sharing options...
jaymc Posted February 26, 2009 Author Share Posted February 26, 2009 modded my code try it ??? <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> I do call that on my page, The code I pasted was all java not in .js files Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772020 Share on other sites More sharing options...
darkfreaks Posted February 26, 2009 Share Posted February 26, 2009 ah ok have you tried adding in the if statement? and the var variable before _uacct ??? also: http://blog.martinlegris.com/?p=86 Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772021 Share on other sites More sharing options...
jaymc Posted February 26, 2009 Author Share Posted February 26, 2009 ah ok have you tried adding in the if statement? and the var variable before _uacct ??? also: http://blog.martinlegris.com/?p=86 It is defined though as I have urchin.js included and the error isnt saying something is undefined... Object issue..? Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772046 Share on other sites More sharing options...
darkfreaks Posted February 26, 2009 Share Posted February 26, 2009 <script type="text/javascript> _udn = "none"; _uacct = "UA-9999999-9"; if (typeof(urchinTracker) != 'undefined'){ urchinTracker();} </script> Quote Link to comment https://forums.phpfreaks.com/topic/146898-ie-object-error/#findComment-772094 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.