I have a manual transcribing tool and I have used an npm package called express-device
. This package detects the device used by the user and acts accordingly. I want it in a way, such that, if the device is a mobile, it will go to another HTML file designed for the mobile device. The code I’ve entered looks like this:
app.get("/", function(request, response) {
var type = request.device.type;
if (type === "mobile") {
response.sendFile(__dirname + "/views/mobile.html");
} else {
response.sendFile(__dirname + "/views/index.html");
}
});
but for some the reason, the website isn’t navigated to the mobile page.
You can view the code here in the server.js file.