Results 1 to 7 of 7

Thread: Set site as homepage Script

  1. #1
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Set site as homepage Script

    this script "Set site as homepage Script" http://www.dynamicdrive.com/dynamicindex9/addhome.htm# works
    good with internet exprorer, but does not work in mozilla firefox. Does anyone know how to change script that would also work with firefox, or add
    some code or something what would open pop-up window and says " Mozilla
    Firefox doesn't allows this action".

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Setting the homepage is a user preference. As far as I know, doing it any more actively than that is supported only in IE. There are somewhat cross browser 'set bookmark' scripts:

    http://www.dynamicdrive.com/forums/s...ad.php?t=17329

    being the best discussion of such that I am aware of.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default set site as homepage

    Quote Originally Posted by jscheuer1 View Post
    Setting the homepage is a user preference. As far as I know, doing it any more actively than that is supported only in IE. There are somewhat cross browser 'set bookmark' scripts:

    http://www.dynamicdrive.com/forums/s...ad.php?t=17329

    being the best discussion of such that I am aware of.

    ok, thanks, bookmark site works good with IE and firefox, but can I do than, this is just example, if you open http://www.google.com/ with IE on the botton of screen you can see "Make Google Your Homepage!" but if you open the same link with Mozilla Firefox then you don't see that message.
    Do you know how to do that? I mean hide (do not show) "Set site as homepage" message when site is open with Firefox.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This will do it similar to how Google does it. The link will only be seen in IE 5+, and only if the page that this code is on is not already the user's homepage.
    This will only work on a live page:

    Code:
    <!--[if IE]>
    <span id="hp" style="behavior:url(#default#homepage)"></span>
    <a href="#" 
    onclick="var HomePage=window.location.href;
    document.getElementById('hp').setHomePage(HomePage);window.location=window.location;return false;"
    ><script type="text/javascript">;(function(){var HomePage=window.location.href;
    if(!document.getElementById('hp').isHomePage(HomePage)){document.write(''+
    // Set Below to desired Link Text or Image Tag:
    'Click here to make Dynamic Drive your default homepage'
    +'')};})();</script></a>
    <![endif]-->
    Edit the highlighted part as needed.
    Last edited by jscheuer1; 01-01-2008 at 08:11 PM. Reason: Upgrade code & fix minor typo
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    This will do it similar to how Google does it. The link will only be seen in IE 5+, and only if the page that this code is on is not already the user's homepage.
    This will only work on a live page:

    Code:
    <!--[if IE]>
    <span id="hp" style="behavior:url(#default#homepage)"></span>
    <a href="#" 
    onclick="var HomePage=window.location.href;
    document.getElementById('hp').setHomePage(HomePage);window.location=window.location;return false;"
    ><script type="text/javascript">var HomePage=window.location.href;
    if(!document.getElementById('hp').isHomePage(HomePage)){document.write(''+
    // Set Below to desired Link Text or Image Tag:
    'Click here to make Dynamic Drive your default homepage'
    +'')};</script></a>
    <![endif]--
    Edit the highlighted part as needed.

    well, now I can see "Click here to make.....homepage" message with IE, and I don't see that message when I open with Firefox, it supposed to be that way, but still something doesn't work right. When I click, nothing happens. On the botton of IE screen, says, "error on page"
    But anyway, thanks a lot for trying.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I think you missed this bit:

    This will only work on a live page
    Oh, and I did leave out the very last > (fixed now in the original) but, that wouldn't cause the error. The error you have is 'permission denied', you cannot make a local page your homepage using this code.

    Demo:

    http://home.comcast.net/~jscheuer1/side/home_page.htm
    Last edited by jscheuer1; 01-01-2008 at 08:20 PM. Reason: Add Demo Link
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    I think you missed this bit:



    Oh, and I did leave out the very last > (fixed now in the original) but, that wouldn't cause the error. The error you have is 'permission denied', you cannot make a local page your homepage using this code.

    Demo:

    http://home.comcast.net/~jscheuer1/side/home_page.htm
    Well, yes works great, you were right, I did miss that part "This will only work on a live page". thanks for help.

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
  •