Results 1 to 13 of 13

Thread: Javascript (basic?) problem ...

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Quick background info :
    I am developing a vbs/web page which will be used as a personal site & will be the first full site I will have developed.
    As it uses vbs, the user needs a version of IE to use & view it properly (not Netscape for example).

    Problem :
    Basically, I need some sample code in Javascript to :
    1) Tell that the user is running IE.
    2) If not, a messagebox appears telling them to get it
    3) If so, navigate them to my starter page (i.e. - main.htm)

    ANY help on this will be GREATLY appriciated. I do not want to learn another lanquage to vb (i.e. Java) as it may confuse me.

    Thank you eveyone !

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  2. #2
    Addicted Member
    Join Date
    Jun 2000
    Location
    Pittsburgh, PA
    Posts
    149
    try this
    Code:
    <script Language="JavaScript">
    <!--
    var capable;
    
    capable = (navigator.appName == "Microsoft Internet Explorer");
            
    if (capable) {
         response.redirect("homepage");
    }
    else{
         alert("you need IE");
         response.redirect("ie site");
    }

  3. #3

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Wow

    Thank you for the quick reply jdavison ! Very much appriciated.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  4. #4

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Talking Pain in the what ?

    jdavison, one quick question, can I have a very simple example of how you would fit a message box or alert to appear instead of the re-direction below.

    Thank you for all of your help!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5
    Addicted Member
    Join Date
    Jun 2000
    Location
    Pittsburgh, PA
    Posts
    149
    just replace the redirect with the alert:
    Code:
    alert("your message here");

  6. #6
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    just curious but why can't the user use netscape?
    I allways use netscape and view asp pages often.
    I may be mistaken but isn't asp made w/ vbs?
    pnj

  7. #7
    Addicted Member
    Join Date
    Jun 2000
    Location
    Pittsburgh, PA
    Posts
    149
    I dont believe netscape will handle client side vbscript. VbScript can be used instead of javascript on the client. I may be wrong on this.

  8. #8
    Addicted Member
    Join Date
    Jun 2000
    Location
    Pittsburgh, PA
    Posts
    149

    Some more input

    Alex,

    You may want to just setup a simple page that runs just tat script and then redirects into your site. I have seen problems from trying to run VBscript and Javascript together on the same page.

  9. #9
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537

    why use vbscript on the client?

    I am new to this but why not use javascript on the client and vbscript on the server?
    then both browser work for the same site.
    pnj

  10. #10

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538


    OK people, this is what I am (trying to) acomplish...

    • I heard that only Java works on netscape & not vbs. I don't want to learn java as I am concentrating on vb & don't want to confuse myself with another lanquage as from what I can see, vb goes into more or less everthing, games, web sites etc.
    • Client / Server side just confuses the b@!locks off me, all I am trying to do here is a personal web page - not on a server that any idiot can look at, nothing special like a company page.
    • This is the first page - purely Javascript to tell the user that if they have Netscape, my code won't work so come back when they have IE. This is the only page using the java bit, if the user has IE, then they are redirected to my fantastic site which purely uses vbs!


    just to clear up few points there & bore you to death I thank you for all of your help everyone!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  11. #11

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Whoops...

    Hi everyone, I just cannot seen to get this one up & running, either with Jdavidson's code or my adapted :
    Code:
    <script Language="JavaScript">
    <!--
    var capable;
    
    capable = (navigator.appName == "Microsoft Internet Explorer");
            
    if (capable) {
         response.redirect("www.microsoft.com");
    }
    else{
         alert("The site has found that you are running an alternative to Microsoft's Internet Explorer" & Crlf & _
    	"This is essential to view this site as it is written in Visual Basic Script". & Crlf & _
    	"Please download this program at : http://www.microsoft.com/windows/ie/default.htm");
         
    }
    
    
    <!--######### DESIGNING #########-->
    <HTML>
    <HEAD>
    <TITLE>ALEX'S HOME SITE</TITLE>
    
    <FONT FACE="Comic Sans MS" SIZE=12>
    
    Checking your browser configuration....
    This should only take a few seconds.
    
    </HEAD>
    </HTML>
    I don't think I have messed IE up, can anyone tell me what I have done wrong please?

    Thank you for your patience.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  12. #12
    Addicted Member
    Join Date
    Jun 2000
    Location
    Pittsburgh, PA
    Posts
    149
    Try it like this

    Code:
    <!--######### DESIGNING #########-->
    <HTML>
    <HEAD>
    <TITLE>ALEXS HOME SITE</TITLE>
    
    
    <script Language="JavaScript">
    <!--
    var capable;
    
    capable = (navigator.appName == "Microsoft Internet Explorer");
            
    if (capable) {
         response.redirect("www.microsoft.com");
    }
    else{
         alert("The site has found that you are running an alternative to Microsoft's Internet Explorer" & Crlf & _
    	"This is essential to view this site as it is written in Visual Basic Script". & Crlf & _
    	"Please download this program at : http://www.microsoft.com/windows/ie/default.htm");
         
    }
    -->
    </script>
    </HEAD>
    <BODY>
    <FONT FACE="Comic Sans MS" SIZE=12>
    
    Checking your browser configuration....
    This should only take a few seconds.
    
    </BODY>
    </HTML>

  13. #13

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Talking Ok Now Thanks !

    Thank you, all works now!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

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



Click Here to Expand Forum to Full Width