Solved

Make This Page Your Homepage Script

Posted on 2004-09-04
7
265 Views
Last Modified: 2008-02-20
Hey guys,

I'm looking for a small scrip, that works in most common (or all) browsers, that when clicked can make my site index as the users homepage. I know that there are tons of Java script ones but I was wondering if anyone here could help me with one in PHP?

Thank you.

Cheers Nemo
0
Comment
Question by:NemoZ
  • 5
7 Comments
 
LVL 7

Expert Comment

by:madwax
ID: 11979788
Hi NemoZ,

This cannot be done solely by php you must use it through the javascript interface, but what you can do is:

<?echo '<A HREF="#" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.yourhomepagecom\');">Make this page your homepage</A>';?>

Cheers!
//madwax
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11979860
As said by madwax this is not possible in PHP.

PHP is server side, all of the script is processed on the server before it is outputted as plain html ready to be sent to the browser, JavaScript operates client side (in the browser) which is why it is possible with that, bookmarking a site with a script requires a clinet side action in the browser.

That said im pretty sure JS boomarking code will only work in IE and given that many people are starting to use alternative browsers such as Firefox its something that i would avoid adding to your page at all.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11979937
Just done a quick check to confirm my suspicion and it seems i was right, all homepage scripts (of which every example is pretty much identical to the one posted by madwax so its a pretty inflexible implementation) are functional in IE only, and as said before are native to the JS language.

So as far as your wish goes for a cross browser script working from PHP im afraid its not going to happen.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 27

Accepted Solution

by:
Diablo84 earned 250 total points
ID: 11979955
Heres an idea i just had, its not exactly what you wanted but it works around some of the issues, the homepage set link will only be displayed in Internet Explorer:

<?php
$browser = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strstr($browser,"ie")) echo '<a href="#" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.google.com\');">Set as Homepage</a>';
?>

So any other browser (which doesnt support the feature) just wont show the link. I think that is about as near as you are going to get to the goal.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11979961
you might want to make the check a bit tighter by replacing

if (strstr($browser,"ie"))

with

if (strstr($browser,"msie"))

but im working with IE6 and Firefox 0.9 both of which work fine with the original
0
 
LVL 3

Author Comment

by:NemoZ
ID: 11980019
Thank you both for your help.

Cheers Nemo
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11980021
no problem :)

|)iablo
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Update database from a form 8 35
Echo images using file system 2 29
simplest php form 3 57
Form not operating correctly. 1 22
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now