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
    New Coder
    Join Date
    Apr 2008
    Posts
    26
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Set As Homepage Link Script

    Hi

    I'm trying to write a script that sets as homepage in IE but links to a url in all other browsers. The url will be a page which gives information on how to set the homepage in Firefox, Opera, Safari etc. It's not working though. I'd really appreciate any pointers as to where I'm going wrong. Here's what I have:

    Code:
    <script>
    function setHome() {
    this.style.behavior='url(#default#homepage)';
    this.setHomePage('http://www.mysite.com')"; else{location.href='/set_homepage_info.html'}}
    </script>
    
    <a href="javascript:setHome()">Set As Homepage</a>

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    You have no if that goes with the else.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Apr 2008
    Posts
    26
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Doh! I can't believe I left that out. The if is in my original script but I forgot to copy and paste it. Script below as is but it's still not working:

    Code:
    <script>
    function setHome() 
    {if(document.all)
    this.style.behavior='url(#default#homepage)';
    this.setHomePage('http://www.mysite.com')"; else{location.href='/set_homepage_info.html'}}
    </script>
    
    <a href="javascript:setHome()">Set As Homepage</a>
    This is the usual set homepage link that I'm trying to modify if it helps:

    Code:
    <a href="#"
    onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.mysite.com');">Set As Homepage</a>
    Last edited by iChick; 05-01-2008 at 03:32 PM.


  •  

    Posting Permissions

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