Accessing cell number in mobile website - javascript

Is there a way I can access mobile number of the phone through which I am accessing the web page?
Is there any open source JavaScript API to do this?

I'm going to take stab at this and say that its not possible. If it were that would be a huge breach of privacy on the phones. Also see here
Retrieve IMEI number/ sim number/mobile number via mobile browser

Related

What's more accurate than GPS in determining location on mobile

I have a company where I want to show every detail like offices, ladders and WC's on a map on a mobile app to be displayed to visitors.
I want also to track the visitors inside the company or "Mall" through their mobiles ... counting them a day for example , and making a small social network between them.
GPS unfortunately isn't accurate enough to be used here. can you suggest a better localization method ?
Bluetooth beacons are designed for this kind of thing but depend on you getting users to download the app and turn on Bluetooth. Look into Apple's iBeacon standard and Google's Eddystone. Both can be used on Android and iOS.

How can I access to USB stick from website?

I'm planning to make a login system by USB, so if you put in a USB-drive and open a specific webpage, the website asks the USB-drive for the code (e.g. by a JavaScript file, a redirect or something like that).
The problem is, because of sandboxing, you can't load or redirect to local files. I don't know a solution for this problem. Can you guys help me? I don't need specific code, just an example or something in that way.
Maybe you can read up on USB-HID. Wikipedia:
The USB human interface device class (USB HID class) is a part of the USB specification for computer peripherals: it specifies a device class (a type of computer hardware) for human interface devices such as keyboards, mice, game controllers and alphanumeric display devices.
Here are some references:
USB HID (Human Interface Device)
node-hid - Access USB HID devices from node.js
DepthJS: 'Allows any web page to interact with the Microsoft Kinect using Javascript'.
A related Stackoverflow question:
Write data to USB HID using Javascript, HTML5, or any cross platform language (supports Android)
One other possibility is to check out the Chrome HID (Human Interface Device) APIs:
Interacting with USB HID devices from web apps – via Chrome Apps, see below
Relevant Chrome API docs
Please note that for the time being, you cannot interact directly with the USB device (i.e. you cannot access any WebAPI offering that kind of fine-grained control).
Building a Chrome App (different from a Chrome Extension) may help; This article may point you in the right direction, since it also provides sample code.
The only way I can think of is putting a html file on the usb stick that essentially generates some sort of login token and gives you a link or a form to a login processor. You can then access the webpage by opening the local file first which will redirect you to the actual webpage.
This local script may include a javascript from the server to get some challenge-response-data which it hashes somehow (perhaps in combination with a password) and puts it into the form data.
Web PKI authentication from Modern Browsers may be achieved by using Browser Extension. One such extension is Signer.Digital browser extension. Use below Javascript promises from the APIs provided by Signer.Digital extension.
SignerDigital.getSelectedCertificate() to register user's certificate
SignerDigital.signHash(hash) to sign token at browser and verify at server
For all Javascript APIs refer to SO Answer https://stackoverflow.com/a/63173083/9659885
Disclaimer : I work for a company supporting the application below
Hello, you may try to use Nexu open-source application for communication with smartcards or USB tokens. It also support PKCS 12 keystores.
For example, the application is connected to the DSS webpage on the website of European Commission : see the link.

How to detect a page request is from mobile or desktop client side

We have developed a website which has general homepage and mobile page, one is for mobile and other is for PC.
I want code to detect the device automatically and navigate to the mobile homepage if the user is from mobile and navigate to the homepage(general) if the user is from PC and problem is it should be using JavaScript or plain HTML.
http://detectmobilebrowsers.com/ has an open source javascript function to detect a mobile browser that you can use.
To determine this you need to check the HTTP header for the request for your website, in particular the User-Agent string.
You haven't mentioned what technologies you're using, but you can redirect at the web-server level or within your application.
Don't make separate sites. Use reactive design. The browser on my phone is just as good as the one on my desktop.
you can use below code,
var index = navigator.appVersion.indexOf("Mobile");
This will return you negative value if the request is not from mobile site.
Happy learning :)

Can a mobile Web app obtain Android device identification information?

At a recent event a developer working for one of the top US mobile operators told me that "an HTML5 Web app can obtain unique device identification information on any Android device it runs in." The comment was about Web-native apps in cell phones, not HTML5 running inside a WebView in a Java app.
How can this be done? Unfortunately, I don't have access to the developer to ask.
At a minimum, I would consider any of the following to be uniquely identifying the device: ANDROID_ID, phone number and IMEI for GSM or MEID/ESN for CDMA. There may be other types of identifiers I'm not familiar with.
You can't get those details from the browser. I'd be concerned if you could!
You could use cookies to uniquely identify a user, but there's no way to personally identify them. Even then cookies can be cleared.

Is there a way for a website to determine if it is being viewed in an iPad and if it is being viewed with and iPhone/Android/Pre

I want to create a website that can be visited by type of browsing device and when the user visits the site on different devices (iPad, iPhone, Netbook, PC) they immediately see the version of the site optimized for them instead of having to go to m.example.com . I know that you can specify html to print etc. Is there a type for device sizes and types (multitouch vs. mouse based)?
Yes, your webserver can examine the USER_AGENT string that comes with every request. Each of thee devices you mention will send a string uniquely identifying what it is. I'm on a mobile device now, and don't have references, but you'll find what you need if you google 'useragent'.
Once you know the device, you can easily send device-specific HTML, stylesheets and/or JavaScript to tailor the experience for each device.
Good luck!
use CGI::Info;
my $info = CGI::Info->new();
if($info->is_mobile()) {
......
}

Categories