Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question browser detection

    hi all,
    I need a script making so that it can only provide updates if a certain browser is accessing the updates page. The browser version is 4.0 (compatible; MSIE 6.0; Windows NT 5.1; Browsemaster v1.1) and the update page is http://www.freewebs.com/yowzagames-m...master/updates (this page hasn't been added yet because I need the script)

    The updates will be shown as links in a html page. I need it so that only the browsemaster client can view the updates page, IE shouldn't be able to view it, or netscape, just the browsemaster client from version 1.1 onwards. Can anyone provide a script that fits the description and tell me what to place where in the html document.(i.e. what part of the script should be placed in the head, body, etc.)It needs to be javascript, not php because freewebs don't support it.

    Thanks in advance,
    regards,
    Scott.

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    You could put this javascript code in the head of a html page. Other browsers would continue to the body while Browsemaster clients will be taken to somepage.htm

    if(navigator.userAgent.indexOf("Browsemaster")!=-1)
    {
    window.location.href="somepage.htm";
    }

    HTH

  • #3
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Puffin the Erb
    You could put this javascript code in the head of a html page. Other browsers would continue to the body while Browsemaster clients will be taken to somepage.htm

    if(navigator.userAgent.indexOf("Browsemaster")!=-1)
    {
    window.location.href="somepage.htm";
    }

    HTH

    what is browsemaster?
    edit: lol, I should've read the thread starter's post.
    Last edited by fci; 10-30-2004 at 03:15 PM.

  • #4
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    It's part of an arbitrary value placed in the browser's identifying string ( navigator.userAgent ) by the developers of the browser. For example, Microsoft use 'MSIE' and several browsers 'Gecko'.
    Some browsers make it easy to change this string so that they appear to be something they are not.
    Because of this, using the identifier is not 100% safe, it would be better to know if 'Browsemaster' had a unique capability ( that no other version of MSIE 6.0 has) that could be tested for.

  • #5
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    browsemaster is my very own browser, i finished version 1.1 of it yesterday.It's gonna be added as soon as i've made the page for updating straight from the browser.

    I got something similar to that script earlier and it didn't work, this one doesn't seem to work either

    The only unique feature I can think of are it's update button which just directs you to a page with the updates listed (the page with the script on) and the other feature is a button that leads to my site by clicking it. Are there any other scripts that i could use to check that it is browsemaster and not IE, netscape, firefox, etc. accessing the updates page?

    TIA,
    Scott.

  • #6
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    I took for granted the browser supports JavaScript as it had MSIE in its string.
    If it doesn't, what server side scripting language do you have access to?
    You can use a server-side language to query the server variable HTTP_USER_AGENT which returns the same string you mentioned earlier and is the equivalent of navigator.userAgent.

  • #7
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's an internet client that is just based on top of IE, not like a skin though. The only languages that i'm aware of that my host (freewebs) supports are javascript and html, i know that they don't support php. Vbscript maybe? i don't really know how to go about this. i really do need this script within the next few days, i just don't know why it won't work. I've had an idea, hidden code. If a user is using browsemaster, maybe there could be some text on screen telling them they are using browsemaster. It could tell them what version of browsemaster they are using and give them a link to the updates page that doesn't have any code except html in it. if they aren't using browsemaster, maybe it could say something like 'you don't have a compatible browser, please click here('here' being a link to the main site) to return to the main site'.

    The initial script i was after was an auto-update script to check if there were any browsemaster updates and update in the background if there were. I realised this was going to be too hard and decided to try and get a page with a script like this in it.

    I'm also looking for a new name for it. Any ideas?

    TIA,
    Scott.

  • #8
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just got this script:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    
    var name = navigator.appName;
    var vers = navigator.appVersion;
    vers = vers.substring(0,1); // or 0,4  could return 4.5 instead of just 4
    
    if (client == "Microsoft internet explorer")
    url="updates";
    else
    url="incompatible";
    url += vers + ".html";
    window.location=url;
    
    // You may make the redirection automatic by using this
    // window.location=url;
    // instead of the three document.write lines above
    
    // End -->
    </script>
    It needs editing to fit Browsemaster but i'm not sure what i should change.

  • #9
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    That code won't do it.
    You need to detect Browsemaster IE and not just IE anyway.
    Also, if the code I supplied did not work then nor will adapting the code you found.

    The host does not support html and javascript. These are client-side technologies so are dependent on the visitor's browser ( client-side ) supporting them.

    Are you sure you put the code I suggested in a <script> section?

    <script language="JavaScript" type="text/javascript">
    <!--
    if(navigator.userAgent.indexOf("Browsemaster")!=-1)
    {
    window.location.href="somepage.htm";
    }
    -->
    </script>

    Note also the above is case sensitive so "Browsemaster" is not the same as "browsemaster".

    Does the following code work in your browser?
    If so what does the alert box say?

    <script>
    alert(navigator.userAgent);
    </script>

    If this does not work then either JavaScript is disabled or the browser does not support it. You will need to find out what server-side languages your host supports if this is the case......

  • #10
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The alert box says this exactly:

    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Browsemaster v1.1)

    I did try the other script in script tags, that's simpleton stuff.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •