jeudi 7 juillet 2016

JS equivalent to PHP's getallheader() [duplicate]

I'm trying to access header information with JS, on my PHP hosted pages I know this can easily be done with getallheaders() This is what I would like to replicate that is currently working via PHP:

foreach (getallheaders() as $name => $value) {
    if($name1 == "Mail")
    {
        $email = $value;
    }
echo $email;

As for the duplicate questions:

How do I access the HTTP request header fields via JavaScript? 6 answers

  • The accepted answer only gives access to document.referrer and navigator.userAgent and this is not what I'm looking for.

Accessing the web page's HTTP Headers in JavaScript 11 answers

  • The accepted answer here does provide the header for the current page, however is missing all of the header info that a redirect from sso adds.

Aucun commentaire:

Enregistrer un commentaire