mobile-safari

Media queries - targeting specific devices together

强颜欢笑 提交于 2019-12-12 00:39:07
问题 I've got a devices stylesheet that is loaded to deal with responsive design in a website, but I'm struggling to group a couple different media queries exactly how I want. I've got a shared set of styles for a small web window, a mobile device at any rotation and an iPad in portrait only. At the moment I'm getting everything except the iPad with this query: @media all and (max-device-width: 480px), all and (max-width: 480px) I'm getting the iPad in portrait with this code: @media only screen

Opening “data:xxx” URLs in Safari

霸气de小男生 提交于 2019-12-11 19:35:54
问题 I'm failing to open data URL:s in iOS/Safari. NSString* stringUrl = @"data:text/html;base64,PGh0bWw+DQo8Ym9keT4NCjxzY3JpcHQgbGFuZ3VhZ2U9IkphdmFTY3JpcHQiPg0KZG9jdW1lbnQubG9jYXRpb249J2h0dHA6Ly93d3cuZ29vZ2xlLmNvbSc7DQo8L3NjcmlwdD4NCjwvYm9keT4NCjwvaHRtbD4="; NSURL* url = [NSURL URLWithString:stringUrl]; NSLog(@"Got url: %@", url); const BOOL STATUS = [UIApplication.sharedApplication openURL:url]; NSLog(@"STATUS: %d", STATUS); This is supposed to open Safari on an iOS device. The resulting page

mobile safari - reliable callback for when Image loads?

非 Y 不嫁゛ 提交于 2019-12-11 18:56:01
问题 I try to load an image as such: var img = new Image(); img.src = 'mars.png'; img.onLoad = callback; function callback(){ // doesnt fire alert("loaded"); } the callback never fires, whats the workaround? 回答1: You MUST define the onload BEFORE you change the src and event handlers are lowercase so it is spelled onload var img = new Image(); img.onload = callback; img.src = 'mars.png'; function callback(){ alert("loaded"); } or as I prefer it var img = new Image(); img.onload = function(){ alert

iPad hover/click issue

為{幸葍}努か 提交于 2019-12-11 17:44:03
问题 I have my HTML code as; <a href="someTarget.html" class="menuLink">Link</a> Now the JS code previously was; $(".menuLink").mouseover(function(){ //code for show() submenu } $(".menuLink").mouseout(function(){ //code for hide() submenu } I am testing this on iPad and the above code worked fine on the iPad (i.e. on first tap, it fires the hover event and shows the submenu and only on the next tap does it fire the click event or go to the target link) For some reason (adding delay to the main

mobile safari rendering buttons with border

自古美人都是妖i 提交于 2019-12-11 16:48:08
问题 I have a set of buttons and they are rendering strangely in mobile safari. There is an uneven border around each one. That is how they appear on mobile safari, and below is how they appear in every other browser. The code I have for the buttons is: <div id="buttonbox"> <div id="button1" class="buttons"><a href="one/two-wrong.html?">2 CHOICE1</a></div> <div id="button2" class="buttons"><a href="one/two-wrong.html?">2 CHOICE2</a></div> <div id="button3" class="buttons"><a href="one/two-right

Caching sounds on Mobile Safari

两盒软妹~` 提交于 2019-12-11 16:27:46
问题 I have to play very short sounds on UI events (pressing a button, showing a popup) in my iOS web-app. I do it the following way: // Standard HTML5 implementation of PlaySound. function Html5PlaySound(sound) { var player = document.getElementById('soundPlayer'); player.pause(); player.setAttribute('src', 'sound/' + sound + '.mp3'); player.play(); } Unfortunately, it's being reloaded every time (I see 'waiting circle' in the title bar). Is it possible to force somehow iPhone to cache the sounds

Getting ipad device information using safari web browser

半城伤御伤魂 提交于 2019-12-11 15:27:33
问题 We have an web application which users access from the iPad safari web browser.We want certain kind of analytic about the users. I want to know what information can i get through the safari browser about the user`s iPad.Can i access 1) iOS version installed. 3) Safari web browser version. 2) UDID of device. 回答1: You can analyze the User Agent ID, and it will tell you which iOS version is used and the version number of MobileSafari, but AFAIK there is no way to query the UDID (luckily, I might

On iPad, video doesn't go fullscreen using HTML5

允我心安 提交于 2019-12-11 14:02:48
问题 I tried getting a video to display fullscreen on iPad using HTML5, but the result I get is: First time click video is play Second time click fullscreen video is play it will appear. I can't get both the video to play and turn fullscreen when activated. Here's the source I've been using: $(document).ready(function() { $("#te").bind('click', function() { $('#myVideoTag')[0].play(); $('#myVideoTag')[0].webkitEnterFullScreen(); }); }); 回答1: I was running into the same issue, and setTimeout seems

Prevent iOS web app w/ redirect from opening link in mobile Safari

萝らか妹 提交于 2019-12-11 14:01:32
问题 I’m currently developing a web app using HTML5, CSS3 and PHP that connects to Readmill’s API with oAuth. I want the website to behave like a web app (“installed” on home screen) on iOS which leads to my problem: To authenticate users, my page has to redirect to Readmill’s authentication page. This works flawlessly if the user has been logged in before using mobile safari and uses cookies—hence is still logged in and just has to tap on “Allow” on the “Grant access” page. If the user isn’t

why iOS mobile cannot use focus()

[亡魂溺海] 提交于 2019-12-11 12:37:52
问题 I'm trying to use the javascript function focus() , but it does not work on safari mobile. How do I fix this problem? <html lang="en"> <head> <meta charset="UTF-8"> <title>demo</title> <script type="text/javascript"> window.onload=function() { document.getElementById('username').focus(); } </script> </head> <body> <input type="text" id="username" > <input type="text" > </body> </html> 回答1: iOS does not allow .focus() to be fired automatically for security reason. 回答2: I was having the same