This question already has answers here:
Determine a user's timezone
(27 answers)
Closed 1 year ago.
The community reviewed whether to reopen this question 2 months ago and left it closed:
Original close reason(s) were not resolved
This is a question of how to do it without JavaScript
Imagine JavaScript is disabled in the browser. Is there a way for us to understand the current time on the user machine?
For example can we ask the browser to fill a hidden field in a form?
You can set the date in a text input like so:
<input type="date" value="2021-10-24" />
However, there's no way to automatically populate that value on the browser side without using JavaScript. That means if you need this to work you'd have to use PHP or some other server side implementation to pre-fill the input with the current date when it's served to the client. Obviously this could have timezone implications and would not be the date on the user's machine, but is probably as close as you'd be able to get with JS disabled.
Related
This question already has answers here:
Setting PHP's default timezone
(3 answers)
Closed 4 years ago.
How do you change the time zone without php.ini? Is this possible to change the timezone per directory? Preferably without the need to have super user privileges, so I don't have to contact my web provider.
date_default_timezone_set('America/Chicago');
would set the timezone to 'America/Chicago' for a given script.
This question already has answers here:
Create unique Poll/vote/survey in php
(3 answers)
how to identify remote machine uniquely in php?
(7 answers)
Closed 6 years ago.
We have a small web-poll system we use in a math class before semester begin on voluntary base. On one hand we dont want the students have to register or download something, because of possible lost of poll participants. On the orher hand there are some students who manipulate the poll by sending lot's of junk answers.
Is there a way to identify a user machine over http? Ideas how to create an simple identification?
Simple: it is not possible to get the users computer name with Javascript. You can get all details about the browser and network. But not more than that.
If you are looking for a simple solution just use a cookie with a far future expire marking the device as already voted. However, this is just a simple solution and does not protect you against users with minimal IT skills. You could consolidate the separation by saving a hashed value of their Browser version/os/ip with each vote and you can filter results when counting
This question already has answers here:
JavaScript for detecting browser language preference [duplicate]
(26 answers)
Closed 8 years ago.
I have a basic dropdown menu where the user is able to select the language the website should appear in. My problem is not everyone understands "Select Language". So I was trying to find a method that allows to detect the language of the browser and serve an appropiate text accordingly.
For example if:
User Agent is in English
then:
"Select Language"
How do I do this with PHP or Javascript?
On the server side in PHP, use the Accept-Language header to determine the browser's configured language. Details can be found in this answer.
This question already has answers here:
Client Time shown instead of server Time in javascript
(4 answers)
Closed 9 years ago.
I want to detect that from which country and form which timezone my website is opened by user using java script or Jquery
Timezone is possible to get with Javascript alone, country is not possible without a third-party service or server-side process like GeoIP:
var timezone = new Date().toString().match(/\(([A-Z]+)\)$/).pop()
This question already has answers here:
How to enable cookies via javascript
(3 answers)
Closed 8 years ago.
Is there any way to enable browser cookies using Javascript? I need to show the user data in the form page which has filled by the user earlier. Please get me some solution to show the data which has already submitted before in the form page.
This cannot be done as it would bring security issues.