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 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation dissapearing "set as homepage" link!

    If you have Google or MSN search (http://www.live.com) as your homepage, you probab;y would have noticed, that if you click on the "make google your homepage" link once, and when you www.google.com again after setting it as your homepage, the link dissapears.

    and if you set something else as your homepage, and then visit www.google.com, the link to set google as your homepage appears again.

    How can I achieve that with javascript?? I tried playing with Google's code, but didnt actually work!

    thanks,


    VatsaL

  • #2
    Regular Coder ttttt's Avatar
    Join Date
    Oct 2005
    Posts
    372
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'll need to set a cookie telling you that it is set as homepage. Then a simple if statement will detect if the cookie is set or not. If it is then no link, if it isn't, then display the link.
    ttttt
    http://openoffice.org/- Microsoft Office without the Microsoft.
    [home page][forum]
    Versatile, free software

  • #3
    New Coder
    Join Date
    Nov 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ttttt View Post
    You'll need to set a cookie telling you that it is set as homepage. Then a simple if statement will detect if the cookie is set or not. If it is then no link, if it isn't, then display the link.
    yeah, but woth cookies, there is a limitation - If the user's security level is high, or set not to accept any cookies, then the function wouldnt work! ..and if the user is one that frequently deletes cookies, then its worse!
    thats why, I wanted to use javascript.

    any idea how to, though?

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,620
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Well the only way Javascript can do it is by using cookies. If you prefer then you cvould do it using server side processing and cookies instead but without the cookie there is no way of telling what the home page is set to. Not also that if your visitor has plugged the security hole that allows Javascript to update the home page then the cookie will be set but the home page wont be changed.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Regular Coder ttttt's Avatar
    Join Date
    Oct 2005
    Posts
    372
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you used a server-side language, you might be able to do it using IP logging etc. but you'd have to use a database.
    ttttt
    http://openoffice.org/- Microsoft Office without the Microsoft.
    [home page][forum]
    Versatile, free software


  •  

    Posting Permissions

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