Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 962
  • Last Modified:

Using javascript instead of PHPs header function for redirect

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
luxurylink
Asked:
luxurylink
  • 4
2 Solutions
 
mattjp88Commented:
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
 
TeRReFCommented:
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
 
Harisha M GCommented:
Hi,
> We are not concerned with users who have javascript disabled.

Then NO !

But I would go for META redirect

---
Harish
0
Independent Software Vendors: 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!

 
Harisha M GCommented:
<META HTTP-EQUIV="refresh" CONTENT="0;http://www.something.com/somepage"
0
 
Harisha M GCommented:
oops forgot >

<META HTTP-EQUIV="refresh" CONTENT="0;http://www.something.com/somepage">
0
 
Harisha M GCommented:
You must put that between <HEAD> and </HEAD>
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now