March 21st, 2012, 01:04 AM
In HTML you can have:
<!--[if IE 6]><![endif]-->
Can I have a JS file where I have an if statement that tells the browser to either ignore or recognize JS?
March 21st, 2012, 04:58 AM
For IE? Have IE run/not run the code while other browsers do the opposite?
March 21st, 2012, 07:08 PM
You can wrap a <script> tag in an HTML if statement.
March 21st, 2012, 09:43 PM
The if statement was just an example.
I am wanting to do something like
if(document.domain == "example.com")
March 22nd, 2012, 12:37 AM
var script = document.createElement('script');
March 22nd, 2012, 01:01 AM
March 22nd, 2012, 05:24 AM
you could use the html if to add a class to your body
then test for it in js
<!--[if lt IE 7]><!--> <body class="ie"> <!--<![endif]-->
<!--[if gt IE 6]><!--> <body> <!--<![endif]-->
var is_ie = $(body).hasClass('ie');
a: true is 1 and false is 0 right?
March 22nd, 2012, 09:39 AM
Comments on this post
March 22nd, 2012, 09:43 AM
As E-Oreo says, you need to ask a better question. If you are unsure what it is you require to achieve your goal, state what it is you need to achieve.
Originally Posted by E-Oreo