Home >Web Front-end >HTML Tutorial >How does an html file get the browser's userAgent when script is disabled? _html/css_WEB-ITnose

How does an html file get the browser's userAgent when script is disabled? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:25:081273browse

How does an html file obtain the browser's userAgent when script is disabled?
I want to get the browser's userAgent in the noscript tag pair, then pass the userAgent to USER_AGENT, and then send it to the server. Please ask for the specific code



Reply to discussion (solution)

The server-side program can obtain it , no need to upload it, unless you want to fake it

Server-side program can get it, no need to upload it, unless you want to fake it

I don’t understand, I’m a newbie. I originally called the js file in html, sent the data to the server's submit.php through js, which inserted the data into the database, and then another php page read the data in the database.

I want to send data directly from the html file to submit.php when the user accesses my html page in a browser with js disabled, and sends it through js when the user does not disable js.

How should I determine and send when the user disables js?

The questions you asked before and after are completely different

The questions you asked before and after are completely different. This... It is my first time to write js and html, and I have just learned it, so please forgive me for the unclear expression.
I just want to get the browser's userAgent from the noscript tag pair of the html file.

1. Noscript cannot be obtained
2. If the userAgent is submitted to the server, it is not necessary. The server program can obtain it by itself (sent by the browser by default), and does not need to be submitted by the client

1.noscript cannot be obtained
2. If the userAgent is submitted to the server, it is not necessary. The server program can obtain it by itself (sent by the browser by default), and there is no need for client submission

The userAgent is submitted to the server's database. When js is disabled, if it is not disabled, js will send the data. First send the userAgent data to submit.php, and then insert it into the database from submit.php.
In submit.php, $USER_AGENT=$_REQUEST['USER_AGENT'];

if (!mysqli_query($conn ,"INSERT INTO t_Item (Click ,Rreal ,FLAGS,USER_AGENT ,REFER,LH )
VALUES ('$Click','$Real','$FLAGS','$USER_AGENT','$REFER','$LH')"))
{
$message = " 'Error insert item::" .mysqli_connect_error();
echo "";
}

So where should I change?

$USER_AGENT=$_SERVER["HTTP_USER_AGENT"]

$USER_AGENT=$_SERVER["HTTP_USER_AGENT"] Okay, thank you very much

$USER_AGENT=$_SERVER[" HTTP_USER_AGENT"]

I also want to get the location.href of the html that sends data to submit.php in submit.php. What should I write in submit.php?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn