Solved

Using javascript instead of PHPs header function for redirect

Posted on 2006-06-29
6
956 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
Technology Partners: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

740 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