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.
luxurylinkAsked:
Who is Participating?
 
mattjp88Connect With a Mentor Commented:
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 GConnect With a Mentor Commented:
Hi,
> We are not concerned with users who have javascript disabled.

Then NO !

But I would go for META redirect

---
Harish
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.