Solved

Using javascript instead of PHPs header function for redirect

Posted on 2006-06-29
6
957 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

751 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