Necuima Posted March 16, 2018 Share Posted March 16, 2018 Hi Larry, Can you please give me your thoughts on two window relocation techniques that I use as to which one, if any, is better. $url and header (in PHP) or JS window.location.replace(url) with the urls set appropriately. window.location.replace seems to be better if you are using sessions to avoid the 'headers already sent' issue but I'd appreciate your advice. Best wishes from Oz Link to comment Share on other sites More sharing options...
Larry Posted March 19, 2018 Share Posted March 19, 2018 Personally, I would always do it in PHP if you can. In other words, if the need for redirection is identified in the PHP code, then the redirection should happen there. Conversely, if the user has visited a page already and you want to redirect them without them loading another page, you'd use JavaScript. This should be fairly uncommon. Link to comment Share on other sites More sharing options...
Necuima Posted March 20, 2018 Author Share Posted March 20, 2018 Thanks, Larry, I always appreciate your advice. Cheers Link to comment Share on other sites More sharing options...
Recommended Posts