Bookmarking and make this as your homepage code on php

Discussion in 'PHP' started by ico, Feb 28, 2007.

  1. #1
    Hi… I’m new in php script can anyone provide me the code for bookmarking the site and setting the site as your default homepage...

    Thanks a bunch….:)
     
    ico, Feb 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Not possible with PHP. Try in the Javascript section...
     
    nico_swd, Feb 28, 2007 IP
  3. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #3
    You cannot Bookmark a page or set a page as homepage using PHP, since its a serverside language. You should use Javascript for that. Only IE 5+ supports changing homepage.
    Bookmark This Page Script:
    
    <script type="text/javascript">
    function addBookmark(url, title){
    if(!url){
    	url = document.location;
    	title = title ? title : document.title;
    }
    if (window.sidebar) // Firefox 1.x+
    	window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print){ // Opera 7+
    	var el = document.createElement('a');
    	el.setAttribute('href',url);
    	el.setAttribute('title',title);
    	el.setAttribute('rel','sidebar');
    	el.click();
    } else if(document.all)// IE4+
    	window.external.AddFavorite(url, title);
    }
    </script>
    
    
    Code (markup):
    Use the following code to call the function
    <a href="javascript:addBookmark('http://forums.digitalpoint.com/showthread.php?p=2428165', 'Bookmarking and make this as your homepage code on php')">Bookmark this Page</a>
    Code (markup):
    or
    <a href="javascript:addBookmark()">Bookmark this Page</a>
    Code (markup):
    Set As Homepage Script:
    
    <a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://forums.digitalpoint.com/showthread.php?p=2428165');">Click here to set this page as homepage</a>
    
    Code (markup):
     
    Aragorn, Feb 28, 2007 IP