SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot Kamran's Avatar
    Join Date
    Sep 2000
    Location
    UK
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I've seen on a few sites, links to make that website your default homepage - does anyone know the code for this?

    Thanks

    Kam

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2001
    Location
    Toronto, Ontario, Canada, Earth
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:

    Code:
    <script languag=JavaScript>
    function setHomepage(f) {
    if (f.style != null) {
    f.style.behavior='url(#default#homepage)';
    f.setHomePage('http://www.yoursite.com/')
    }
    else {
    alert("Your browser does not support this function.");
    }
    }
    </script>
    <a href="#" onClick="setHomepage(this);return false;">Make This My HomePage</A>
    Jason Weinstein
    webmaster@MaximumEdge.com
    http://www.MaximumEdge.com/

  3. #3
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Although you may not desire that "Your browser does not support this feature" message. Here's one that always includes the text but only makes it a link if the browser supports that function. It is only a link on IE though.

    You might want to use a combination between this and maximumedge's code.

    Code:
    <script language="JavaScript"><!--
    pageurl="http://amphigory.8m.com/";
    pagetitle="The Mostly Amphigory Website";
    if ((navigator.appVersion.indexOf("MSIE") > 0)
      && (parseInt(navigator.appVersion) >= 4)) {
        var sText = "<U><SPAN STYLE='color:navy;cursor:hand;'";
        sText += "onclick='window.external.AddFavorite(pageurl,";
        sText += "pagetitle);'>";
        document.write(sText);
    }
    // -->
    </script>
    
    Keep up to date - bookmark this page
    
    <script language="JavaScript"><!--
    if ((navigator.appVersion.indexOf("MSIE") > 0)
      && (parseInt(navigator.appVersion) >= 4)) {
        document.write("</SPAN></U>");
    }
    // -->
    </script>
    Last edited by mmj; Apr 25, 2001 at 06:34.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  4. #4
    SitePoint Addict gthorley's Avatar
    Join Date
    Oct 2000
    Location
    Canada
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by maximumedge
    try this:

    Code:
    <script languag=JavaScript>
    function setHomepage(f) {
    if (f.style != null) {
    f.style.behavior='url(#default#homepage)';
    f.setHomePage('http://www.yoursite.com/')
    }
    else {
    alert("Your browser does not support this function.");
    }
    }
    </script>
    <a href="#" onClick="setHomepage(this);return false;">Make This My HomePage</A>
    Jason Weinstein
    webmaster@MaximumEdge.com
    http://www.MaximumEdge.com/
    Jason does this work in NS as well as IE?


    O.T.

    I have noticed you have provided some excellant answers on a variety of subjects. Nice website. I particularily like the map function. How is this done? Do you keep the map on your database or just refer to another. Can anyone do this on their site.

  5. #5
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You all include option to show an alert etc.
    How about totally concealing it in NS?

    Why show the user when its not going to be of use anyway?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  6. #6
    SitePoint Zealot
    Join Date
    Apr 2001
    Location
    Toronto, Ontario, Canada, Earth
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by gthorley

    Jason does this work in NS as well as IE?
    the automatic setting of the homepage only works in IE. if the browser doesn't support it then it alerts the user with a message.

    Originally posted by lynlimz
    You all include option to show an alert etc.
    How about totally concealing it in NS?

    Why show the user when its not going to be of use anyway?
    the idea i meant was that you could provide useful information in the alert box instead of what i put in the code. for example, on my site i provide detailed instructions in the alert box on how to change their homepage in netscape by changin their preferences when their browser doesn't support this function. also, it's a subtle way of convincing users to set your site as their homepage.

    Jason Weinstein
    webmaster@MaximumEdge.com
    http://www.MaximumEdge.com/

  7. #7
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. You have a point.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  8. #8
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any JavaScript bookmark utilities do not work in Netscape, as there is no current method for a JavaScript coder to access Netscape's bookmark DOM.

    Thus, all bookmark scripts only work in IE
    My 2 Cents (or is that 2.2 Cents including GST?)


Bookmarks

Posting Permissions

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