SitePoint Sponsor |
|
User Tag List
Results 1 to 18 of 18
Thread: checking for browser
-
May 2, 2007, 11:49 #1
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
checking for browser
Hi,
I´m doing check for browser allowing only IE to pass through, redirecting the others to a error page. But when a Firefox with No-Scripts extension opens the page, the js browser check doesn´t load, so it opens normaly.
How can I check for js support, to add to my if clause, so the firefox with No-Scrip also is redirected to error page?
-
May 2, 2007, 12:38 #2
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi mjunior,
Without seeing your code I can't really suggest much, but if it were me I'd probably use JScript conditional compilation.Cross-Browser.com, Home of the X Library
-
May 2, 2007, 13:11 #3
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:/*@cc_on @if (@_jscript) // any version of IE // ...code for IE... @else @*/ // ...code for non-IE... /*@end @*/
Cross-Browser.com, Home of the X Library
-
May 2, 2007, 13:37 #4
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So why are you only supporting IE?
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
-
May 2, 2007, 18:18 #5
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeah I know that you advise just the oposite, but by now all the layouts and designed pages made by others to our intranet were made and tested only in IE, so it'' ll be a hell of a work to compliance them all at the moment.
The checking I'm doing now is:
function detectBrowser(){var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)
if ((browser!="Microsoft Internet Explorer")
&& (version>4)) {window.location='browser.asp?msg=browser'}
}
-
May 2, 2007, 20:09 #6
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So why don't you want to allow people to see the broken pages if they want to see them?
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
-
May 2, 2007, 22:03 #7
- Join Date
- Apr 2007
- Posts
- 813
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So why don't you want to allow people to see the broken pages if they want to see them?it is just a matter of preference. No big deals to hide ugly things and prevent it to be shown.
-
May 3, 2007, 09:33 #8
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So, what should I add to my " if " statement to prevent from no js enable on the browsers?
-
May 3, 2007, 11:54 #9
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
Why not just surround all the body of your page inside an IE conditional so that the page looks blank to anyone using a proper web browser.
<body><!--[if IE]>
<p>this content will only show in Internet Exploder.</p>
<![endif]--></body>Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
May 3, 2007, 11:57 #10
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The problem with that would be if you had any HTML comments in the content of the page.
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
-
May 3, 2007, 20:44 #11
- Join Date
- Jul 2006
- Location
- Thailand
- Posts
- 162
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If you wanted to kick non-IE users out, you can use:
Code:<![if !IE]><meta http-equiv="refresh" content="0;url=http://www.google.com/" /><![endif]>
-
May 4, 2007, 04:05 #12
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
-
May 4, 2007, 07:04 #13
- Join Date
- Nov 2005
- Location
- The Netherlands
- Posts
- 808
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Considering the site only works in IE and it's too much work to make it behave in other browsers, I doubt it'll validate in the first place
Good point. There's no way you can use a Javascript function to redirect a user when Javascript is disabled
Anyway, I'd do as Kravvitz suggested; just show the broken page. Why go out of your way to prevent this?
Also, I like this approach by Dean Edwards.
-
May 4, 2007, 13:14 #14
- Join Date
- Dec 2006
- Posts
- 182
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just let people see it and let it render poorly - better they get ugly content than no content.
-
May 4, 2007, 18:08 #15
- Join Date
- Apr 2007
- Posts
- 813
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
well, it is better to notify them switching to another browser
-
May 5, 2007, 17:57 #16
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
Some people don't get a choice of browser when their particular disability means that the one they are using is the only one that they can make work properly for them. Anyway, people should be able to choose the browser that they want to use and if enough of them use a crappy non-standard browser you have to patch your page so that it works there as well as in decent modern standard compliant browsers. (on second thoughts let's all not patch our sites to work with the non-standard browsers and maybe that will force people to abandon IE7).
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
May 7, 2007, 09:55 #17
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So there´s no way, right?
-
May 7, 2007, 19:07 #18
- Join Date
- Jun 2006
- Location
- Australia
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No i think of a single way to do this and nor should there be
Bookmarks