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'> <div id='nosensors' class='message'>
<p>Your browser could not connect to phone's sensors.</p> <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><button id='nosensors' class='message'>OKAY</button></div>
</div> </div>
@ -324,7 +324,7 @@ var th_handles = function(e) {
}; };
if(window.DeviceOrientationEvent) { if(window.DeviceOrientationEvent && iOS()==false) {
window.addEventListener('deviceorientation', do_handles); 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> </script>
</html> </html>

4
works/Danja Vasiliev/otastaImg/otastaImg.ino

@ -19,7 +19,7 @@
//#define STASPSK "mypassword" //#define STASPSK "mypassword"
#endif #endif
IPAddress apIP(192, 168, 4, 1); IPAddress apIP(8, 8, 8, 8);
const char* ssid = STASSID; const char* ssid = STASSID;
//const char* password = STAPSK; //const char* password = STAPSK;
@ -46,7 +46,7 @@
//redirect all traffic to index.html //redirect all traffic to index.html
server.onNotFound([]() { server.onNotFound([]() {
if(!handleFileRead(server.uri())){ 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); server.send(200, "text/html", metaRefreshStr);
} }
}); });

Loading…
Cancel
Save