in reply to Send before headers - in perl,

I think it was for window redirects, when we already had printed header files.

Perhaps you mean <meta http-equiv="refresh"...? The other way is with JavaScript, both methods can even be combined on the same page.

isn't there a way to have something execute before the headers?

If you mean on the server side, then you'd have to delay the output of the headers; once they've been sent to the client there is no way to take it back. But in general you can execute anything you like before you send the headers.

Replies are listed 'Best First'.
Re^2: Send before headers - in perl,
by bizactuator (Sexton) on Jun 30, 2022 at 06:04 UTC
    JavaScript could be disabled though, so securest way is in code... eval worked for me in Perl, I went and searched my code and it did work.

    maybe not the way it was intended but it worked for me.
      eval worked for me in Perl, I went and searched my code and it did work.

      I'm not sure eval explains it, though, so it would be interesting to see your code. The only way I can think of at the moment that eval could be used to delay something is to delay a BEGIN block or use.

      JavaScript could be disabled though, so securest way is in code...

      Yes, my first example doesn't require JavaScript.

        You're correct, my bad, that is in the header section, a browser function regardless of javascript. lol. I don't think I realized it until you point it out. lol.