Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

detect IE6 ?


Go to End


3 Posts   1336 Views

Avatar
snaip

Community Member, 181 Posts

20 October 2009 at 9:57pm

hi

i have function which determine the type of IE version

function ie6() {
	$przegladarka=$_SERVER['HTTP_USER_AGENT'];
	if(strpos($przegladarka, 'MSIE 6') == true) { 
             echo "you are using IE6";
	}
	else {
	     echo "you dont have IE6";
	}
}

and works good

but now i need to include one .ss file when user have IE6 and second .ss file when he have other
how to do it in template ?

i tryed this:

function ie6() {
	$przegladarka=$_SERVER['HTTP_USER_AGENT'];
	if(strpos($przegladarka, 'MSIE 6') == true) { 
             $ie = 1;
	}
	else {
	     $ie = 0;
	}
}

<% control ie6 %>
	<% if ie == 0 %>
                <% include non_ie_file.ss %>
	<% else %>
	        <% include ie_file.ss %>
	<% end_if %>
<% end_control %>

but it doesnt work

Avatar
snaip

Community Member, 181 Posts

20 October 2009 at 10:09pm

Edited: 20/10/2009 10:11pm

ok i solved this problem

function ie6() {
	$przegladarka=$_SERVER['HTTP_USER_AGENT'];
	if(strpos($przegladarka, 'MSIE 6') == true) { 
		return true;
	}
	else {
		return false;
	}
}

<% if ie6 %>
     you have IE6
<% else %>
     you dont have IE6 
<% end_if %>

Avatar
Taffy

Community Member, 119 Posts

20 October 2009 at 11:52pm

There is also a widget @ http://silverstripe.org/ie-6-detection/