Jump to content

Configuring .htaccess to allow certain browsers

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
HumansAreFriendsNotFood

HumansAreFriendsNotFood

    Newbie

  • Members
  • PipPip
  • 24 posts
Hi all, I was wondering how you would go about configuring your .htaccess file to only allow entry to your site by the latest releases of the main five browsers? I know that the site I am working on displays and functions as it should in these browsers and as the site will only attract a small number of people so this would be of great use. If there is another way of doing this by maybe adding some code in each html page then that's fine by me :)

Thanks in advance for your help.

Edited by HumansAreFriendsNotFood, 15 April 2010 - 03:57 PM.
typo in title


#2
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
You can use Javascript to detect info about the users browser using 'this.dataBrowser', and the version of the browser using 'navigator.userAgent' or 'navigator.appVersion'. However, you'll have to deal with the data they give you manually, and also update your script as new releases appear.

Outside of Javascript, there may be another method but I'm not sure.

#3
HumansAreFriendsNotFood

HumansAreFriendsNotFood

    Newbie

  • Members
  • PipPip
  • 24 posts

semprance said:

You can use Javascript to detect info about the users browser using 'this.dataBrowser', and the version of the browser using 'navigator.userAgent' or 'navigator.appVersion'. However, you'll have to deal with the data they give you manually, and also update your script as new releases appear.

Outside of Javascript, there may be another method but I'm not sure.

Thanks for your reply, I'm not really worried about the future realeases as I will add in conditional comments etc. to support them. Would you be able to write a script that would do this for me? I have no knowledge of Javascript - it'd be most appreiciated if you could :)

#4
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
I don't really have the time. If you google round plenty of people have done similar things to this before, just find someone elses and modify it for your needs.

#5
HumansAreFriendsNotFood

HumansAreFriendsNotFood

    Newbie

  • Members
  • PipPip
  • 24 posts
Ok then, thanks for the idea - I'll google it later :thumbup1:

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
This is a really bad idea.

I've already had issues with one site that did this, and failed to correctly detect the DEVELOPMENT version of Firefox as Firefox.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog