•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 391,998 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,175 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 2150 | Replies: 3
![]() |
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
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
•
•
Join Date: Aug 2004
Posts: 49
Reputation:
Rep Power: 5
Solved Threads: 1
By the time the onunload triggers the person is no longer on your page to be able to bookmark it.
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
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
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
•
•
•
•
apple beta bon browser code css development div dreamweaver echo email encryption firefox google checkout google checkout vat html html api internet javascript microsoft mobile mozilla news nintendo opera patch pda privacy safari security spoof symantec tables testing url w3c web webmail wii windows wysiwyg xml
- Detect browser window closing event in Firefox - (JavaScript / DHTML / AJAX)
- bookmark a page (ASP.NET)
- closing a window (Java)
Other Threads in the HTML and CSS Forum
- Previous Thread: <Body onload= > question
- Next Thread: On Paste


Linear Mode