Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect from HTML deprecated?

I've heard that the usual way I redirect from an HTML page, like

<meta http-equiv="REFRESH" content="0;url=page.html">

is deprecated by the latest HTML. Is it true or not, and if so, what other ways are there to redirect?

like image 550
John Avatar asked Nov 01 '12 01:11

John


2 Answers

The proper way to redirect is to send redirect headers. You need to change status from 200 OK to appropriate 3xx status. Then you also need to include Location: http://yourRedirectURL header. The implementation depends on what programming language you are using in the back-end.

like image 139
valentinas Avatar answered Oct 12 '22 12:10

valentinas


Using the Location header is both seamless and a more efficient way to redirect someone to another page, assuming you're just using a zero timeout anyways.

Unless you're placing them on a landing page first then redirecting them, use the Location header.

I should also note that the location header specifies it should be provided with a fully qualified address to land on and not use an absolute or relative site-based path. E.g.

Location: http://www.google.com/

Instead of:

Location: /login
Location: ../../home
like image 34
Brad Christie Avatar answered Oct 12 '22 10:10

Brad Christie