Click to See Complete Forum and Search --> : Ask: Add to favourites? On Exit
PL2007
01-13-2007, 06:26 AM
Hi,
Here is a completely new one on me, but I'm hoping someone can help me.
If a user clicks on the X (top right) to close or types a new address into the address bar etc. but is leaving the site completely in any case, is it possible for them to get a quick IE box asking if they would like to save the site to their favourites before they go. Then they get a yes/no option. If they click on yes the site should go straight to favourites and they can carry on going to wherever they were going.
Is that possible with HTML, PHP or whatever?
felgall
01-13-2007, 02:09 PM
You can only do it with Javascript.
<script type="text/javascript">
window.onbeforeunload = function() {
if (window.external && confirm('add to favourites?'))
window.external.AddFavorite(self.location,document.title);
}
</script>
grumpyoldtechs
01-14-2007, 05:10 AM
and thats why people have javascript turned off.
The Old Sarge
01-14-2007, 11:44 AM
That's one reason.
jeddik
01-18-2007, 03:55 PM
I wonder what percentage of users turn off javascript ?
At a guess, I would say ... less than 2 %
Any thoughts ?
Charles
01-18-2007, 04:01 PM
It's known to fluctuate between 5 and 10%. And I'm one of those happy people.
jeddik
01-19-2007, 05:19 AM
WOW I am surprised its so high !
I looked in my FF and can see clearly where to enable or disenable javascript - but I could't see it it in IE. There is a huge list under the Advanced tab - but I didn't see a Javascript option - anyone know where it is ? :o
jeddik
01-19-2007, 05:22 AM
Of couırse if people start writing annoying alert boxes when I leave their site, not only wont I visit their site again, I may well turn off js.
But then I know that I would have to put it on again to use some sites that I want to use.
The Old Sarge
01-19-2007, 11:06 AM
This brings up an interesting question .. a bit off topic perhaps.
If you have JS off and my site stats are dependent on JS, does this mean my stat counter does not "see" you when you visit?
tracknut
01-19-2007, 12:12 PM
It would be far better to put a link on your page to perform this function at the user's option.
Dave
felgall
01-19-2007, 03:42 PM
WOW I am surprised its so high !
I looked in my FF and can see clearly where to enable or disenable javascript - but I could't see it it in IE. There is a huge list under the Advanced tab - but I didn't see a Javascript option - anyone know where it is ? :o
In IE the option is set from within the Security tab and is set on a zone by zone basis. IE doesn't actually run Javascript - it runs JScript and VBscript instead and there is one option called ActiveScripting to turn these on and off near the bottom of the list. JScript is the IE equivalent to Javascrit that is close enough to run most of the javascript code and different enough to cause you to pull your hair out when testing the code to make sure that it works both on modern browsers and IE.
felgall
01-19-2007, 03:51 PM
Of couırse if people start writing annoying alert boxes when I leave their site, not only wont I visit their site again, I may well turn off js.
But then I know that I would have to put it on again to use some sites that I want to use.
Modern web browsers allow you to enable and disable many of the annoying but sometimes useful features on a site by site basis.
There is an extension for Firefox that allows you to put enable/disable buttons for Java and Javascript in the statusbar where you can easily turn them on and off as required and Opera has similar options built into the quick preferences menu. Only IE makes it difficult to turn it on and off quickly by burying the option where a lot of people can't even find it.
I suspect one of the main reasons for a lot of IE6 users having turned it off is that when you disable activeX to plug about 600 of the otherwise unplugable holes in that browser you get constant popups about pages not displaying properly because activeX is didabled unless you also disable SctiveScripting (JScript and VBscript). Since IE7 properly disables all of the activeX that can lead to security holes by default and only allows a small number of the safe ones to run there isn't a reason for turning it off in that browser.
Of course there are a lot of people using web readers, mobile devices etc to view web pages where the pages are more easily handled without Javascript. THat's why your page always needs to be usable without javascript with Javascript only being used to enhance the page.
PL2007
01-20-2007, 06:27 AM
I won't be adding this JS to my site then.............
Besides, it comes up when you refresh the page, change the page within the website and the back button on the browser.
Hmm, good way to make friends....(not)....I can see why you are all trashing it now.