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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    144
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question Browser Home Page

    Hi Guys

    Is it possible to combine the following to bits of code. The first code will send the user to the browser home page if using IE.

    Code:[[a href="about:home">home</a>]]

    The second code will send the user to the browser home page if using Firfox.

    Code:[[input type="button" onclick="if (window.home) window.home()" value="Home">]]

    Both codes work in their respective browsers, but can they be combind.

    As the man from Tesco's says "Every little helps".

    Regards,

    Dingbat

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,300
    Thanks
    203
    Thanked 2,561 Times in 2,539 Posts
    Here you are:-

    Code:
    <input type="button" onclick="goHome()" value = "Home">
    
    <script type = "text/javascript">
    function goHome() {
    if (document.all) {  // IE
    window.location = "about:home";
    }
    if (window.home) {window.home()}  // Firefox and Opera
    }
    
    </script>
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    144
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hi Phillip M,

    Thanks for the reply, it worked just fine.

    Regards,

    Dingbat.


  •  

    Posting Permissions

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