TecBrat Posted March 30, 2007 Share Posted March 30, 2007 I have found many occasions where I want to use an existing script inside one of my pages. If I have html content before the script starts, I have run into problems because the scripts use something like header('Location: ' . $url); and I get header already sent errors. I found that I can replace that code with ?><meta http-equiv="refresh" content="0; url=<?echo($url);?>"><? and it works. The last time I used it, I could actually see the refresh even though the content is set to zero, but that's not too big a deal. I was wondering if anyone could tell me what, if anything, I might expect for problems caused by this change. Quote Link to comment Share on other sites More sharing options...
only one Posted March 30, 2007 Share Posted March 30, 2007 your gonna want header, meta only works after the page is shown, but php is read before anything is shown, thats why if you use a header it refreshes straight away Quote Link to comment Share on other sites More sharing options...
hockeyman10 Posted March 30, 2007 Share Posted March 30, 2007 Back in the summer I couldn't get Header to work in Firefox. Is this still a problem? Quote Link to comment Share on other sites More sharing options...
neel_basu Posted March 30, 2007 Share Posted March 30, 2007 Use header() Just to redirect User Dont Send anything to the browser even dont send any text (echo ) And If You wanna use meta use it whenever you want. In your HTML. Quote Link to comment Share on other sites More sharing options...
Full-Demon Posted March 30, 2007 Share Posted March 30, 2007 Be sure you use the header before you do anything. With meta tag, the user will first receive the page and that the browser redirects. Same for javascript though. I use javascript (although I hate that language) to redirect a user when the page is already (partly) loaded. But use the header if possible. Full-Demon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.