function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MarrisMarris 

IE 8 Conditional Statement error

Hi all,

 

           I code the comment for IE8 in visualforce page as follows

 

<!--[if lt IE 8]>
<link rel="stylesheet" href="{!URLFOR($Resource.Styles,'/css/portal.css')}"/>
    &lt;![endif]--&gt;
    &lt;!--[if IE]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    &lt;![endif]--&gt;

It works well but <!--[if lt IE 8]> <![endif]--> <!--[if IE]> displays in the top of the page.

 

Please Provide me a solution

 

Thanks

Marris   

MarrisMarris

Hi all 

 

          Previously i coded the comment like this

 

<!--[if lt IE 8]>
    <link rel="stylesheet" href="/css/ie.css" />
    <![endif]-->
    <!--[if IE]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif] --> 

 But it doesnt work that IE 8 CSS doesnt executed. So Please provide me a solution 

 

Thanks

Marris

Rahul SharmaRahul Sharma

Hello Marris,

 

I think you could detect the browser using jQuery.

Link : jQuery Browser Detection

And for including the Javascipt or CSS file you would need to create a file and attach it to the needed place for eg:head, body, any other tag.

for example on adding the Script to page, refer : 

http://javascript.about.com/library/bladdjs.htm

Include Js or CSS .

 

 

MarrisMarris

Hello Rahul

 

                My code below works well for IE8 browser but in my page i seen this tag <!--[if lt IE 8]> <![endif]--> <!--[if IE]>   at  top. Can you please provide me a solution for not getting this tag at top. Code is as follows

 

&lt;!--[if lt IE 8]>
    <link rel="stylesheet" href="{!URLFOR($Resource.Styles,'/css/portal.css')}"/>
    &lt;![endif]--&gt;
    &lt;!--[if IE]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    &lt;![endif]--&gt;

 

Thanks

Marris

Rahul SharmaRahul Sharma

Hi Marris,

 

I tried to use your code to debug whether its going in the if loop or not.

<!--[if lt IE 8]>
	<SCRIPT LANGUAGE="javascript">
	        alert("Congratulations! You are running Internet Explorer 8.");
        </SCRIPT>
<![endif]-->
<!--[if IE]>
	<SCRIPT LANGUAGE="javascript">
	        alert("Congratulations! You are not running Internet Explorer 8.");
        </SCRIPT>
<![endif] --> 

 but this does not work for me, try alerting the conditions and check if the if condition is executed or not..