Does anyone know how to set a browser's home page from a link with javascript or something similar? I've looked all over the place with no luck.<br>
<br>
Thanks in advance.<br>
<br>
Doug
Depends on what type of link that you mean... do you mean jump links with a drop down menu to different links? I can help you with that; it's a lifesaver for a huge web site...<br>
<br>
<br>
-Kyrene
Basically, I'm looking for a way to save a page in a browser so that it pops up automatically when a user opens the brower.<br>
<br>
I've seen ways to script bookmarking a page, and I'm sure I've seen pages that let you click on a link to make it your home page, but I have yet to find any kind of script that will make a page your home page....
Oh!!! Sort of like the "click to automatically bookmark this site" links that I've seen?<br>
<br>
Ok...that I don't know how to code... but next time I see one of those, I'll view the document source and try to figure it out. I think I know what you're talking about....<br>
<br>
<br>
-Kyrene
OK, here's a link with JavaScript enhancement, along with the other necessary JavaScript info to do what you're wanting:<br>
<br>
<a href='#' onClick="makehomepage(window.location); return false">Click here to set this as you home page</a><br>
<br>
<script language=javascript><br>
<!--<br>
<br>
function makehomepage(url)<br>
{<br>
//Set variable for error messages<br>
var pls=" Please follow the instructions below to set your home page manually.";<br>
<br>
//Detect carrier;<br>
if (navigator.appName== "Netscape" && navigator.appVersion.charat(0) >= 4)<br>
{<br>
<br>
//Set home page<br>
window.onerror=Oops();<br>
netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");<br>
navigator.preference("browser.startup.homepage", home_page_url);<br>
window.onerror=Oops();<br>
alert('Congratulations, your new home page has been set successfully.');<br>
return false;<br>
<br>
//Create function to alert when something doesn't work;<br>
function Oops()<br>
{<br>
instruct("I'm sorry, there was an error while setting your new home page."+pls);<br>
}<br>
<br>
//Create function to alert/redirect when an error occurs;<br>
function instruct(message)<br>
{<br>
alert(message);<br>
window.location.href="/sethomepage.html"<br>
}<br>
} else {<br>
instruct("I'm sorry, your browser does not allow us to set your home page automatically."+pls);<br>
}<br>
<br>
//--><br>
</script><br>
<br>
<br>
Just a note: the only thing missing here is the page: /sethomepage.html<br>
I have left it up to you to create a page that describes how to set your site as a user's home page if you would like, or to simply delete the lines:<br>
window.location.href="/sethomepage.html"<br>
AND<br>
//Set variable for error messages<br>
var pls=" Please follow the instructions below to set your home page manually.";<br>
<br>
From the script if you would rather not make this page.<br>
<br>
Special note:<br>
If you DO delete these lines, you will need to set<br>
var pls = ''<br>
DO NOT just delete the variable declaration as this would lead to HIGHLY UNDESIREABLE effects.<br>
<br>
Feel free to contact me if you need any more assistance.<br>
<br>
-Robherc<br>
<br>
<br>
ICQ#: 34916735<br>
Work E-mail: robherc.work@angelfire.com
Thanks! I've been looking for a script like this for some time. You've really helped me out. I'll let you know how it goes once I've implemented it.<br>
<br>
Doug
Ok, let me know if I can be of anymore help!<br>
I'm sure there will be times when I need help with something too, so I think it's a really good practice to DO some helping before I NEED some <br>
I hope the script works well for you (Oh, BTW: the script that I gave you above is a modified version of a script that can be found at:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.