All Questions
Tagged with iphone javascript
3,040
questions
441
votes
28
answers
462k
views
Detect a finger swipe through JavaScript on the iPhone and Android
How can you detect that a user swiped his finger in some direction over a web page with JavaScript?
I was wondering if there was one solution that would work for websites on both the iPhone and an ...
228
votes
9
answers
146k
views
QuotaExceededError: Dom exception 22: An attempt was made to add something to storage that exceeded the quota
Using LocalStorage on iPhone with iOS 7 throws this error. I've been looking around for a resolvant, but considering I'm not even browsing in private, nothing is relevant.
I don't understand why ...
193
votes
11
answers
304k
views
How do I put a clear button inside my HTML text input box like the iPhone does?
I want to have a nice little icon that, when clicked will clear the text in the <INPUT> box.
This is to save space rather than having a clear link outside of the input box.
My CSS skills are ...
182
votes
12
answers
257k
views
How do I correctly detect orientation change using Phonegap on iOS?
I found this orientation test code below looking for JQTouch reference material. This works correctly in the iOS simulator on mobile Safari but doesn’t get handled correctly in Phonegap. My project is ...
168
votes
18
answers
135k
views
iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?
I'm writing a web app for the iPad (not a regular App Store app - it's written using HTML, CSS and JavaScript). Since the keyboard fills up a huge part of the screen, it would make sense to change the ...
142
votes
8
answers
102k
views
What are some methods to debug Javascript inside of a UIWebView?
I'm trying to figure out why something with Javascript isn't working inside of a UIWebView. To my knowledge, there is no way to set a breakpoint inside of XCode for a js file. No problemo, I'll just ...
132
votes
16
answers
147k
views
Detecting touch screen devices with Javascript
In Javascript/jQuery, how can I detect if the client device has a mouse?
I've got a site that slides up a little info panel when the user hovers their mouse over an item. I'm using jQuery....
119
votes
8
answers
190k
views
Javascript for "Add to Home Screen" on iPhone?
Is it possible to use Javascript to emulate the Add to Home Screen option in Mobile Safari's bookmark menu?
Something similar to IE's window.external.AddFavorite(location.href, document.title); ...
116
votes
6
answers
263k
views
javascript scroll event for iPhone/iPad?
I can't seem to capture the scroll event on an iPad.
None of these work, what I am doing wrong?
window.onscroll=myFunction;
document.onscroll=myFunction;
window.attachEvent("scroll",myFunction,...
110
votes
8
answers
159k
views
$(document).click() not working correctly on iPhone. jquery [duplicate]
This function works perfectly on IE, Firefox and Chrome but when on the iPhone, it will only work when clicking on a <img>. Clicking on the page (anywhere but on a img) wont fire the event.
$(...
103
votes
9
answers
164k
views
prevent mobile default keyboard when focusing an <input> from showing
this is how i'm trying
<script type="text/javascript">
$(document).ready(function(){
$('#dateIn,#dateOut').click(function(e){
e.preventDefault();
});
});
</script&...
101
votes
11
answers
119k
views
How do I reset the scale/zoom of a web app on an orientation change on the iPhone?
When I start my app in portrait mode, it works fine. Then I rotate into landscape and it's scaled up. To get it to scale correctly for the landscape mode I have to double tap on something twice, ...
90
votes
10
answers
78k
views
Programmatically selecting text in an input field on iOS devices (mobile Safari)
How do you programmatically select the text of an input field on iOS devices, e.g. iPhone, iPad running mobile Safari?
Normally it is sufficient to call the .select() function on the <input ... /&...
90
votes
10
answers
163k
views
Mobile Safari: Javascript focus() method on inputfield only works with click?
I have a simple input field like this.
<div class="search">
<input type="text" value="y u no work"/>
</div>
And I'm trying to focus() it inside a function.
So inside of a ...
86
votes
15
answers
95k
views
Determine if user navigated from mobile Safari
I have an app, and I'd like to redirect the users to different pages based on where they are navigating from.
If navigating from web clip, do not redirect.
If navigating from mobile Safari, redirect ...
85
votes
11
answers
26k
views
What is the PastryKit Framework?
I'm trying to find any information I can on the PastryKit Javascript Framework. It appears to be in use on the iPhone User Guide that is displayed on the iPhone itself in Mobile Safari, but I cannot ...
82
votes
8
answers
130k
views
Invoke native date picker from web-app on iOS/Android
I'm trying to explore the posibilities with running a native web-app on different platforms using HTML5. Currently, an <input type="date">field just opens the standard soft keyboard on Android ...
78
votes
1
answer
5k
views
Why is a Safari page breaking iOS rendering?
I know the title is not that explanatory but here is the story: I am developing a browser game, mostly using JavaScript and the Mapbox library.
Everything works well on desktop, Android and iOS but ...
72
votes
10
answers
110k
views
Why can't JavaScript .play() audio files on iPhone safari?
I've got a JavaScript web app working that plays some audio periodically like this:
var SOUND_SUCCESS = new Audio('success.mp3');
SOUND_SUCCESS.play();
This works great on desktop browsers (tested in ...
69
votes
8
answers
52k
views
iphone/ipad triggering unexpected resize events
I'm working on a mobile version of my site. I'm using media queries and CSS as much as possible, but I'm also using some javascript to, for example, turn my navigation into a collapse/expand list on ...
67
votes
11
answers
113k
views
Fixed positioning in Mobile Safari
Is it possible to position an element fixed relative to the viewport in Mobile Safari? As many have noted, position: fixed doesn't work, but Gmail just came out with a solution that almost is what I ...
65
votes
10
answers
86k
views
Check if URL scheme is supported in javascript
Is there any way to check if a URL scheme is currently registered on the phone... with javascript?
62
votes
11
answers
136k
views
How do I hide the address bar on iPhone?
How do I hide the address bar on iPhone?
I tried two different methods so far:
The scroll down one pixel trick with JavaScript on page load
And the following meta tags:
<meta name="viewport" ...
61
votes
4
answers
75k
views
How to check browser for touchstart support using JS/jQuery?
In an attempt to follow best practices, we're trying to use the proper JavaScript/jQuery events according to what device you are using. For example, we're building a mobile site that has an tag that ...
60
votes
9
answers
121k
views
Disable scrolling in an iPhone web application?
Is there any way to completely disable web page scrolling in an iPhone web app? I've tried numerous things posted on google, but none seem to work.
Here's my current header setup:
<meta name="...
57
votes
10
answers
105k
views
How to detect a long touch pressure with javascript for android and iphone?
How to detect a long touch pressure with javascript for android and iphone?
native javascript or jquery...
I want something that sound like :
<input type='button' onLongTouch='myFunc();' />
54
votes
11
answers
40k
views
iPad/iPhone browser crashing when loading images in Javascript
I'm trying to build an image gallery in Safari that mimics the iPad photo app. It works perfectly, except that once I load more than 6MB or so worth of images either by adding them to the DOM or ...
54
votes
11
answers
51k
views
Available iPhone Web Application JavaScript UI Library/Frameworks
I'm starting a web application that will target Mobile Safari on iPhone/iPod Touch. I'm evaluating the available client-side JavaScript/CSS libraries/frameworks that are currently out there.
These ...
52
votes
4
answers
45k
views
Is there any way to use window.onbeforeunload on Mobile Safari for iOS devices?
Looks like Apple has disabled the window.onbeforeunload event for iOS devices (iPhone, iPad, iPod Touch). Unfortunately I can't find any documentation as to why this event doesn't work in Mobile ...
45
votes
4
answers
35k
views
IOS HTML disable double tap to zoom
I am designing a website primarily focused on data entry. In one of my forms I have buttons to increment and decrement the number value in a form field quickly. I was using
<meta name="viewport" ...
45
votes
8
answers
77k
views
Preventing default context menu on longpress / longclick in mobile Safari (iPad / iPhone)
For a website I want to show a custom context menu when a user "longpresses" the screen. I've created a jQuery Longclick listener in my code to show a custom context menu. The context menu is ...
45
votes
5
answers
32k
views
How to trigger iPhone zoom-out after auto zoom-in to a form?
I have a web form that uses jQuery to submit a search. The form itself doesn't fire the submit event because I catch that and drop it (this is all part of a much larger and more complex form and I'm ...
44
votes
5
answers
27k
views
How to organize JS files in a Appcelerator Titanium project
I have recently started creating an iPhone application using Appcelerator's Titanium. Since the application is essentially all JS, I needed some advice on how I should organize this project.
It's ...
42
votes
2
answers
32k
views
How to implement an onmousedown and onmouseup on an iPhone touch screen
I've very new to HTML/JavaScript but am learning…
I want to make a button on an iPhone that runs a JavaScript command when it is pressed and another when it is released. I tried to do this using ...
41
votes
9
answers
61k
views
iOS return bad value for window.innerHeight/Width
I'm using window.innerHeight and window.innerWidth instructions to get the browser's available window size. It's working with firefox, safari (on a mac) and android but I get strange results in iOS.
...
41
votes
5
answers
42k
views
Is there a way to debug JavaScript in the iPhone/iOS Safari browser?
I have a strange behavior on the iPhone browser. Is there a tool to debug the JavaScript of the iPhone browser?
I'm hoping there's something more advanced than simple alert() messages. Is there ...
41
votes
4
answers
24k
views
Embed a JavaScript engine in an iOS application
I wonder if anyone has successfully ported a javascript engine/interpreter to iOS. I'm writing an iPhone game that I would like to use Javascript as the high-level scripting language (AI, gameplay, ...
40
votes
4
answers
58k
views
Can you access the iPhone camera from Mobile Safari? [closed]
Is there a JavaScript API for accessing the the iPhone's camera from Mobile Safari?
40
votes
9
answers
55k
views
Geolocation API on the iPhone
Does anyone know whether the iPhone supports or will soon support the W3C Geolocation specification?
I'm looking to build an app for mobile users, but rather than spend the time developing apps for ...
36
votes
7
answers
37k
views
iPad doesn't trigger resize event going from vertical to horizontal?
Has anyone noticed this behavior? I'm trying to write a script that will trigger upon a resize. It works fine on normal browsers, works fine on iPhone, but on iPad, will only trigger going from ...
36
votes
11
answers
20k
views
iOS5 show numeric keypad by default without using type="number" or type="tel"
With the release of iOS5, Apple has added their own validation to input type="number" form fields. This is causing some issues; see this question below which sums it up:
Input type='number' ...
35
votes
2
answers
133k
views
Translating touch events from Javascript to jQuery
I am using
window.addEventListener("touchstart", function(ev){
console.log(ev.touches); // good
});
How can I translate this to jQuery? I've tried:
$(window).bind("touchstart",function(ev){
...
35
votes
6
answers
20k
views
Can I prevent phone from sleep on a webpage
In app I can use http://developer.android.com/reference/android/os/PowerManager.WakeLock.html
but is there a way to keep webpage running and prevent from going to sleep?
It would be nice if it runs at ...
33
votes
6
answers
35k
views
Javascript date parsing on Iphone
I'm working on an offline capabable Javascript site that targets mobile devices. One such mobile device is the IPhone.
I'm trying to parse a date from our REST API (a member of JSON object). I'm ...
33
votes
4
answers
43k
views
Detect iPad orientation change
How to detect with javascript or jquery when user turns iPad from vertical position to horizontal or from horizontal to vertical?
32
votes
3
answers
42k
views
how to intercept Button click inside UIWebview on IOS?
I have a HTML form that has certain fields which i am opening inside a UIWebview. On click of a particular button i want to do a in app action.
The approach i'm using now is on click of the button i ...
32
votes
8
answers
41k
views
Can a website (HTML5,JavaScript) access a mobile device's (android/iPhone) contact list, SDCard files
Can a website (HTML5,JavaScript) access a mobile device's (android/iPhone)
contact list, SDCard files?
A website as in one opened in a browser not a phonegap application/webapp.
32
votes
7
answers
49k
views
Manually triggering the iPhone/iPad/iPod keyboard from JavaScript
I am developing an HTML code editor using simple DIV's and capturing events. When I use this on the iPad the keyboard never pops up since i'm not technically in an editable field.
Is there a way to ...
31
votes
8
answers
46k
views
What is the best method of re-rendering a web page on orientation change?
I have a fluid CSS layout which is rendering badly on an iphone when I change the orientation. (It looks fine when it is refreshed).
I am using the code below to refresh the page on orientation ...
30
votes
2
answers
17k
views
What happens to JavaScript code after app is compiled using Titanium Mobile
I installed Titanium from appcelerator and built the "KitchenSink" example application.
All works well, I'm just wondering where does the javascript code ends up in a built app.
I grep-ed the Xcode ...