|
|
Body Onload Question | ||
Discussion by David252a91 with 8 Replies.
Last Update: November 29, 2006, 7:01 pm | |||
Sun Nov 26, 2006 Reply New Discussion
You could write a function that changes the current window, and stick that in <body onLoad(here)>
Sun Nov 26, 2006 Reply New Discussion
Have you tried something like:
<body onload="window.location.href='http://www.yoursitehere.com'">
That should automatically redirect all your visitors once it reaches the body tag.
Sun Nov 26, 2006 Reply New Discussion
QUOTE (WeaponX)
<body onload="window.location.href='http://www.yoursitehere.com'">
Link: view Post: 92700
Nothing simpler than that already.
By the way, why do you want to do the redirection in the onLoad? If you have nothing you want to show on that page, and want to redirect immediately, put that code in the javascript section at the beginning of the page, that way it doesn't have to wait until the page finished loading. The browser will redirect as soon as it see that code.
Good Luck
Mon Nov 27, 2006 Reply New Discussion
function toSomeFunction()
{
window.location.href="http://somesite.com";
}
This is what is done at download sites which make u wait for the contents of the window to load first and then start the download.
Mon Nov 27, 2006 Reply New Discussion
QUOTE (CaptainRon)
In case you want to make sure that every thing in the current page is visible to the user, then in the head section, write a JS to set the window.onload=toSomeFunction; and declare that function with the redirection code. eg.
function toSomeFunction()
{
window.location.href="http://somesite.com";
}
This is what is done at download sites which make u wait for the contents of the window to load first and then start the download.
Link: view Post: 92720
It's not neccesary to declare a new function for doing such a simple operation, the code mentioned before has the same use:
QUOTE
<body onload="window.location.href='http://www.yoursitehere.com'">And it's sorter, so you will use less bandwidth.
Mon Nov 27, 2006 Reply New Discussion
CODE
winndow.location.href='http://www.yoursitehere.com';at the begining of the page.
Also, you can achieve this same functionallity using a php header function like this:
CODE
<?phpHeader('Location: http://www.yoursitehere.com');
?>
Best regards,
Mon Nov 27, 2006 Reply New Discussion
Wed Nov 29, 2006 Reply New Discussion
TavoxPeru has just written an example
HTTP redirects consists on sending (from the server) a HEADER to the client telling him that the page has changed it's location permanently or just temporaly and the URL to lacate it now.
You can see some examples of how to redirect a webpage here:
http://www.webconfs.com/how-to-redirect-a-webpage.php
Wed Nov 29, 2006 Reply New Discussion
Google Map Like Pins On Image Please helpe me regarding this. (4)
|
(5) How To Trap The URL To Which A User Is Navigating To?
|
Index




