For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > June 2005 > php version of java : self.location.replace("www.url.com"); ??









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author php version of java : self.location.replace("www.url.com"); ??
Peter Van Hove

2005-06-02, 8:55 pm

Hi,

inside html, before <head>, you can put something like this :

<script type="text/javascript">
self.location.replace(www.url.com/newpage.htm);
</script>

which basically instructs the browser to start loading another page asap
(www.url.com/newpage.htm);
This has some limitations, especially when the user has restricted use of
java etc.

Is there a way to do this in PHP ?
like, if there is a link to link.php, this page then starts loading
www.url.com/newpage.htm instead ?


Peter Van Hove

2005-06-02, 8:56 pm

Thanks for the java vs javascript correction.

What do you mean before any output ?
Do you mean before any html is echoed or printed ?
I mean, I can still do php internal scripting before I call header() ...
right ?




"Oli Filth" <catch@olifilth.co.uk> wrote in message
news:NtIne.5764$Mi4.987@newsfe2-win.ntli.net...
> Peter Van Hove said the following on 02/06/2005 19:36:
>
> Please note, there is an *enormous* difference between Java and
> Javascript! They are not related in any way. You are talking about
> Javascript.
>
>
> If you use:
>
> header("Location: http://example.com/blurgh.htm");
>
> before *any* other script output, then this will redirect the user's
> browser. Note that the URL *must* be absolute, i.e. you cannot simply use
> something like /blurgh.htm.
>
>
> --
> Oli



Peter Van Hove

2005-06-02, 8:56 pm


It work but one more question,
because in the end the user's browser is responsible for loading the new
page, is this guaranteed to work with all browsers ?
Or so some browsers get stuck at this point ?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com