Browse Source

added ios detection to danja

master
user 4 years ago
parent
commit
e65cee3620
  1. 18
      works/Danja Vasiliev/otastaImg/data/index.html
  2. 4
      works/Danja Vasiliev/otastaImg/otastaImg.ino

18
works/Danja Vasiliev/otastaImg/data/index.html

@ -189,7 +189,7 @@
<div id='nosensors' class='message'>
<p>Your browser could not connect to phone's sensors.</p>
<p>You can try using Firefox browser or continue in finger-action mode!</p>
<p>Please use Android + Firefox browser!</p>
<div><button id='nosensors' class='message'>OKAY</button></div>
</div>
@ -324,7 +324,7 @@ var th_handles = function(e) {
};
if(window.DeviceOrientationEvent) {
if(window.DeviceOrientationEvent && iOS()==false) {
window.addEventListener('deviceorientation', do_handles);
@ -339,7 +339,19 @@ if(window.DeviceOrientationEvent) {
}
//detect ios
function iOS() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
</script>
</html>

4
works/Danja Vasiliev/otastaImg/otastaImg.ino

@ -19,7 +19,7 @@
//#define STASPSK "mypassword"
#endif
IPAddress apIP(192, 168, 4, 1);
IPAddress apIP(8, 8, 8, 8);
const char* ssid = STASSID;
//const char* password = STAPSK;
@ -46,7 +46,7 @@
//redirect all traffic to index.html
server.onNotFound([]() {
if(!handleFileRead(server.uri())){
const char *metaRefreshStr = "<head><meta http-equiv=\"refresh\" content=\"0; url=http://192.168.4.1/index.html\" /></head><body><p>redirecting...</p></body>";
const char *metaRefreshStr = "<head><meta http-equiv=\"refresh\" content=\"0; url=http://8.8.8.8/index.html\" /></head><body><p>redirecting...</p></body>";
server.send(200, "text/html", metaRefreshStr);
}
});

Loading…
Cancel
Save