0

And that's the problem. This works:

header('Location: http://www.[whatever].com');

That statement works to get the user to the [whatever] site--it displays just fine within the client window of the browser. The problem is that the URL is still being masked such that the user can't see the address string that she was just redirected to in the URL field, but rather she still sees the URL that she originally typed.

Is there a way to have the forward go through holistically, meaning not just the client area of the browser contains the final destination, but also the URL is the client destination's too?

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
user225626
  • 1,091
  • 5
  • 16
  • 32
  • 7
    Is the document with the header command not in the top frame of the browser? – jtheman Feb 13 '14 at 22:16
  • 2
    Your answer probably lies here.. use PHP to output the JavaScript. http://stackoverflow.com/questions/580669/redirect-parent-window-from-an-iframe-action-using-javascript – Patrick Moore Feb 13 '14 at 22:30
  • "holistically" :) the document header is as much part of the "client area" of the browser. But if your document is embedded in a frame you need to forward to your top level frame. – jtheman Feb 13 '14 at 22:39
  • I don't know. I bought a domain and frame forwarded that to an individual page in my hosting acct. so that I could apply a counter to it. I use header() to push the user from there to the site I really want it to redirect to. It does that, displays that content, but the URL as originally typed is still persisted in the URL field. (But I want it to be the final destination URL the user sees in the the URL field, to match the final everything else.) – user225626 Feb 13 '14 at 23:14
  • Set Sail Media, I'll look at that JavaScript solution. Thanks. – user225626 Feb 13 '14 at 23:23
  • jtheman, I don't know if the document with the header command is in the top frame of the browser. How do I find out? – user225626 Feb 13 '14 at 23:24
  • Set Sail Media, it works great! Thanks. – user225626 Feb 14 '14 at 02:26

1 Answers1

1

If PHP performs

header('Location: http://www.[whatever].com');
exit;

the browser redirects to the specified URL http://www.[whatever].com.

In case the redirect gets executed in an iFrame or an HTML frame, the URL isn't displayed in the the browser's URL field, since the original URL was not either.

In any other case, the URL field will reflect the redirected URL.

SteAp
  • 11,853
  • 10
  • 53
  • 88