944,067 Members | Top Members by Rank

Ad:
May 5th, 2005
0

Bookmark when closing browser.

Expand Post »
I am looking for a script that will promt the user to bookmark my site when they try to close the browser. I have seen them in the past I cant seem to find one now that I need it.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
raywood5 is offline Offline
10 posts
since Jan 2005
Dec 4th, 2005
0

Re: Bookmark when closing browser.

I know a javascript code which will prompt the user to bookmark your page:

You will need to change the following to your own details

var url="ENTER YOUR WEBSITE ADDRESS HERE";
var title="ENTER A TITLE FOR YOUR SITE HERE";

Here's the code:

<script language=javascript>
<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

var url="ENTER YOUR WEBSITE ADDRESS HERE";
var title="ENTER A TITLE FOR YOUR SITE HERE";

document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Add my site to your favorites!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('">Add my site to your favorites.</a>');
}
else {
var msg = "Don't forget to bookmark me!";
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
document.write(msg);
}

// End -->
</script>

I also know that you can make something happen when the page is closed using:

<BODY onUnload="Here you need to put something which will activate the javascript code. I'm not sure what though">



I also know that if you save your javascript as a .js file using notepad (take out the <script language=javascript> and </script> if you do this though) you can use:

<SCRIPT SRC="Name of script.js"></SCRIPT>

That's all I know, hope someone else knows the rest.

Martin
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Dec 4th, 2005
0

Re: Bookmark when closing browser.

By the time the onunload triggers the person is no longer on your page to be able to bookmark it.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
felgall is offline Offline
50 posts
since Aug 2004
Dec 5th, 2005
0

Re: Bookmark when closing browser.

You could have a pop-up window with that link on it which will bookmark your page when clicked, but this window will be blocked if the user has a pop-up blocker installed - which most people will.

Unless someone knows how to make a pop-up window which will not be blocked, then the only other way is probably to put a link on your homepage using the above script again.

Martin
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: <Body onload= > question
Next Thread in HTML and CSS Forum Timeline: On Paste





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC