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.
Related
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.
This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
Closed 4 years ago.
I'm installing Intercom (https://www.intercom.com) for customer engagement on my site. With the recommended installation the javascript snippet they gave would have my intercom app_id exposed in the page source.
May not be a big deal, but I was wondering if there was a better way where I could keep that hidden.
May not be a big deal
It isn't.
but I was wondering if there was a better way where I could keep that hidden
You can't.
Intercom need the browser to tell them your ID for their approach to work.
This means you must tell the browser your ID.
The browser is the property of the user and it answers to them.
It is not possible to give the browser information and keep it secret from the user who owns the browser.
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:
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:
Closed 11 years ago.
Possible Duplicate:
Get Client IP using just Javascript?
Using JavaScript how can I find the IP address of the any user who clicks on my link (which shows a html page)?
I am working on a clipboard application in Java and I want the IP/computer name of the user who visits my web application link.
http://jsonip.com
Usage:
http://jsonip.com
Or:
http://jsonip.com/yourcallbackfunction