Bookmark on exit
help me please, i need a script or code that will ask the user if they want to add the page to their favourites upon clicking the x in the top right corner. any suggestions please
help me please, i need a script or code that will ask the user if they want to add the page to their favourites upon clicking the x in the top right corner. any suggestions please
webwiz posted this at 17:39 — 1st September 2007.
He has: 629 posts
Joined: May 2007
You could do that with a script that runs on window.onunload, assuming the visitor's browser allows scripts to add bookmarks.
I don't have a script handy to do that, though.
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
sirtokealot posted this at 18:11 — 1st September 2007.
They have: 19 posts
Joined: Sep 2007
if anyone else can expand i would be grateful
cwboaze posted this at 20:19 — 1st September 2007.
He has: 4 posts
Joined: Aug 2007
ok, here you go.
The Javascript code, add this to the page you want to on close warn about bookmarking the site. ok!
place this code before you body tag, in the header.
<script type="text/javascript">
function bookmarksite(title,url){
if (window.sidebar)
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}
</script>
then add this to your body tag:
onUnload="javascript:bookmarksite('YOURWEBSITETITLE', 'YOURWEBSITEURL')"
'so your body tag should look like this;
<body onUnload="javascript:bookmarksite('YOURWEBSITETITLE', 'YOURWEBSITEURL')">
'Thanks,
CBTheOne
http://www.webdevelopmenttechnology.com
cwboaze posted this at 20:24 — 1st September 2007.
He has: 4 posts
Joined: Aug 2007
forgot to add, to edit this. Add your site title and site url in place of the following text in the body code.
YOURWEBSITEURL and YOURWEBSITETITTLE
I figured you would notice since I put it in like that.
Thanks,
CBTheOne
http://www.webdevelopmenttechnology.com
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.