PDA

View Full Version : Help on google set homepage script



pistolpapa
05-30-2006, 10:03 AM
I was redirected by someone to Javascript for help, as of right now, no solution was found yet in php section.

Here is what I wanted to achieve, exactly like google did.

1. When visitors come to the website, they see a "set it to my homepage" link
2. After user clicks on that link and confirms, the link will disappear. However, if next time when you visit the site, the homepage is altered, then the link will appear again.

There must be some kind of condition checking in the code. I tried to understand this not-so-complicated page, even set up a redirect page mgyhp.html to direct to index.html, however, no luck in successing. The link appears all the time in explorer even after setting the homepage.

<span id=hp style="behavior:url(#default#homepage)"></span>
<script>
//<!--
if (!hp.isHomePage('http://www.google.com/')) {document.write("<p><a href=\"/mgyhp.html\" onClick=\"style.behavior='url(#default#homepage)';setHomePage('http://www.google.com/');\">Make Google Your Homepage!</a>");}
//-->
</script>

jscheuer1
05-30-2006, 04:58 PM
You already have a thread open for this in DD Help, please restrict yourself to one active thread.

http://www.dynamicdrive.com/forums/showthread.php?p=37992#post37992