Solved

Using javascript instead of PHPs header function for redirect

Posted on 2006-06-29
6
958 Views
Last Modified: 2012-06-27
Are there any disadvantages to using javascript for redirects vs. PHP's header function?  We are not concerned with users who have javascript disabled.
0
Comment
Question by:luxurylink
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 6

Accepted Solution

by:
mattjp88 earned 75 total points
ID: 17014612
If you are not worried about the non-JavaScript people, then no, there are no problems.  You would save on bandwidth by using the PHP header function though, then it only send the correct page, as opposed to the old page and then the new page.  If there is something on the page that shouldn't be seen by certain people and you are using javascript to redirect them, then that is a security risk because they could just disable Javascript and they could see the page.

But if you have the option of working with all users, or just some, the choice for which option to choose is clear.

-Matt
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17014614
Well, you will not get the "You are about to be redirected to a connection that is not secure" warning, so that's a pro :))
0
 
LVL 37

Assisted Solution

by:Harisha M G
Harisha M G earned 50 total points
ID: 17014615
Hi,
> We are not concerned with users who have javascript disabled.

Then NO !

But I would go for META redirect

---
Harish
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 37

Expert Comment

by:Harisha M G
ID: 17014629
<META HTTP-EQUIV="refresh" CONTENT="0;http://www.something.com/somepage"
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 17014634
oops forgot >

<META HTTP-EQUIV="refresh" CONTENT="0;http://www.something.com/somepage">
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 17014636
You must put that between <HEAD> and </HEAD>
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question