magwitch
05-01-2003, 10:46 AM
Hi
I'm a real newbie at all this so please bear with me.
When a surfer wants to save a page on my site to his favourites or bookmarks, can I set it up so that the home page is saved each time instead of the page he selects. This must be possible because I'm sure Ive come across it on commercial sites.
Ive searched through the forum for a solution and the nearest I got was the following:
Quote
As stated, you cannot prevent someone from bookmarking your page. However, there are some things you can do to accomplish what you want.
Put your original window inside a frameset. Setup the frameset so it only has one frame with the default page being the one you want your users to see. Of course, this does not prevent someone from right clicking, selecting properties and getting the url of the page within the frame, then entering a manual bookmark. Place one of the following in your page:
<SCRIPT LANGUAGE="JavaScript">
if (self != top)
{
parent.top.document.location.href="index.htm";
}
</SCRIPT>
-or-
<script language="JavaScript">
if (self.location == top.location)
{ top.location = "index.html" }
</script>
If that page was bookmarked, either of these scripts should reload the index page from where you want your users to start. Both scripts are small enough they could probably registered to an onload event inside a body tag. At a minimum, you could make a function call from an onload event within the body tag.
RKM
Unquote
My web pages consist of 3 frames : a title frame and side frame which stay the same and then a page frame which is the one which changes. I tried putting one of the scripts into the title frame, but when i tried to load the page it just kept reloading at a quite a speed.....fun to watch, but not much use.
Thanks for reading through and any help advice you can offer
Magwitch
I'm a real newbie at all this so please bear with me.
When a surfer wants to save a page on my site to his favourites or bookmarks, can I set it up so that the home page is saved each time instead of the page he selects. This must be possible because I'm sure Ive come across it on commercial sites.
Ive searched through the forum for a solution and the nearest I got was the following:
Quote
As stated, you cannot prevent someone from bookmarking your page. However, there are some things you can do to accomplish what you want.
Put your original window inside a frameset. Setup the frameset so it only has one frame with the default page being the one you want your users to see. Of course, this does not prevent someone from right clicking, selecting properties and getting the url of the page within the frame, then entering a manual bookmark. Place one of the following in your page:
<SCRIPT LANGUAGE="JavaScript">
if (self != top)
{
parent.top.document.location.href="index.htm";
}
</SCRIPT>
-or-
<script language="JavaScript">
if (self.location == top.location)
{ top.location = "index.html" }
</script>
If that page was bookmarked, either of these scripts should reload the index page from where you want your users to start. Both scripts are small enough they could probably registered to an onload event inside a body tag. At a minimum, you could make a function call from an onload event within the body tag.
RKM
Unquote
My web pages consist of 3 frames : a title frame and side frame which stay the same and then a page frame which is the one which changes. I tried putting one of the scripts into the title frame, but when i tried to load the page it just kept reloading at a quite a speed.....fun to watch, but not much use.
Thanks for reading through and any help advice you can offer
Magwitch