1

I searched and didn't find an answer without javascript.

I need to somehow redirect the user to other page without using javascript and after i already set the header... is it possible?

Thiago Sabin
  • 137
  • 1
  • 12
  • only possibility is to make user click a button, nothing else automatic. – Iceman Jul 27 '16 at 14:24
  • I searched in Google for "redirect without javascript" and got [this](http://stackoverflow.com/questions/2489376/how-to-redirect-if-javascript-is-disabled) as a first result... – gregn3 Jul 27 '16 at 14:29

1 Answers1

4

You can output a meta refresh.

<meta http-equiv="refresh" content="0; url=http://example.com/">

While it technically belongs only in the <head>, I tested several browsers and they all appear to process it even in the <body>.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368
  • is there any problem using this instead of javascript i mean any cons? – Thiago Sabin Jul 27 '16 at 16:51
  • @ThiagoSabin Needing to do it this way is a bit of a sign that something's iffy in your application. Any modern framework like Laravel does all the logic in the controller, then decides whether to redirect, display a view, etc. before outputting anything to the browser. A meta refresh isn't seen by search engines like a HTTP redirect is, too. – ceejayoz Jul 27 '16 at 16:59