Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-08-2009
Member
 
Join Date: Jan 2009
Posts: 124
some Javascript files only recognize in IE and not in others

I have some Javascript file, I found that these file works only with some of the web browser and not with all the browsers such as it is recognized or opens fine with the IE and when i try to open in the Firefox its cross hair remains searching, how this has to be sort out. what do i do so that it will get compatible with the other browsers as well, Please help
Reply With Quote
  #2  
Old 14-08-2009
Member
 
Join Date: Oct 2008
Posts: 167
Re: some Javascript files only recognize in IE and not in others

It's best to use object detection to accomplish what you need, or use conditional comments. But if you need to detect IE6, Instead of testing in IE, to save time (single programmer not all that skilled) I'd like to just put in a script in my first included file that test for browser and if not firefox or safari. or to target any one of the IE version on there own is quite simple, add the version number to the expression above, e.g. <!--[If IE 6]> HTML <![endif]--> will target IE6 only.
Reply With Quote
  #3  
Old 14-08-2009
Member
 
Join Date: Jan 2009
Posts: 140
Re: some Javascript files only recognize in IE and not in others

Make sure that you call the script when the document has finished loading (that will mean that you will not be able to use document.write()) , otherwise make sure you don't use the XHTML doctype. The comment is not HTML and is therefore ignored by other browsers who will continue to parse the HTML within.
Reply With Quote
  #4  
Old 14-08-2009
Member
 
Join Date: Mar 2008
Posts: 192
Re: some Javascript files only recognize in IE and not in others

Sometimes you just have to sniff for Internet Explorer 6 (and under) in JavaScript. Using conditional comments is a decent solution, using invalid HTML is never something that should be encouraged, particularly as we move towards XHTML and serving webpages as well formed XML which will break if invalid structures are used. If you're not using XHTML (you'll know if your not) it still pays to avoid using hacky Javascript methods to generate HTML elements during rendering.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "some Javascript files only recognize in IE and not in others"
Thread Thread Starter Forum Replies Last Post
unable to recognize files in vlc. Kulvinderji Windows Software 3 16-12-2011 04:48 AM
Mac shows JavaScript error while opening files on SkyDrive Lilija Operating Systems 3 21-12-2010 07:37 PM
Dynamically Loading External JavaScript and CSS Files Adrina_g Software Development 5 02-03-2010 11:36 AM
How to Use javascript to control flash files? Taipai Software Development 3 15-09-2009 06:43 PM
Movie Maker won't recognize .avi files Smowrey Vista Help 7 30-05-2009 06:44 AM


All times are GMT +5.5. The time now is 09:31 PM.