Why doesn't #contenteditable work on the iPhone? - iphone

Safari HTML Reference: Supported Attributes says:
contenteditable
If true, the element can be edited on
the fly; if false, it cannot.
Availability
Available in Safari 1.2 and later.
Available in iPhone OS 1.0 and later.
However, on my iPhone, I can't get it to work. Anyone have success with this?
You can try it with this document (admittedly not pure html, but that document works in desktop Safari, and Chrome and Firefox 3). I haven't been able to get even the simplest html document to be editable in mobile Safari.

contenteditable has been added to iOS 5 beta 2, according to one of the developer videos from WWDC 2011. I suggest signing up to Apple's Safari developer program and downloading that video from the WWDC videos page.
If you sign up to be a Safari dev, you also gain the privilege to submit your Website to their online iOS Web app gallery.
Edit: I've confirmed this works on my iPad running iOS 5.0.1. Try it out here: http://www.quirksmode.org/dom/execCommand/

It works, kind of. I thought contenteditable doesn't work on iPhone before. When I set a div to contenteditable I couldn't move the cursor/pointer to where I wanted to move it. But, when I was fiddling around XHTML with contentEditable within iBooks.app on iPad, I found that "execCommand('insertText', null, 'foobar');" worked within Mobile Safari.

If you wanted to, you could make a virtual keyboard using
clever css and javascript, and make it into a bookmarklet.

If you cannot focus the contenteditable element try adding this to your css
[contenteditable] {
-webkit-user-select: text;
user-select: text;
}

The design mode and content editable are working fine in IOS 5.But in previous versions it is not working.There is post
http://mobile.tutsplus.com/tutorials/mobile-web-apps/safari-5_html5/

I think this is because editing HTML requires quite an advanced user interface. That's why desktop Safari implements it, while Mobile Safari doesn't.

Related

Can't get hyperlinks to work on iPhone

I'm using Microsoft Outlook to build html email with inserted pictures (jpgs). When I apply a hyperlink to the images, they work fine on PCs running Outlook, Nook and iPod Touch. They don't work on iPhones. What happens on the iphone is when the hyperlinks are pressed, a screen comes up with several options like Copy, Print, Facebook..., but no Open like I see on an iPod Touch. I don't know how to correct this. Can anyone help?
Thanks
Have you checked the image type? Maybe it's not supported by iPhone.
Where does this image appear (web browser, email)? Some apps require specific command to fire an event on clicking.
If it's in mobile safari, is it a simple <a href link? http: protocol? Is it going anywhere that apple redirects (google maps, itunes, etc). or is it dependant on Javascript or flash?

Is there a web app that emulates the iPhone browser?

I'm trying to get an iPhone browser emulator to work on my website so it will work on all platforms. Are there any Javascript snippets that emulate the iPhone browser? I need it to zoom and browse the web, but the bookmark function is not required.
There isn't such a thing, as the iOS browser has a number of differences to any desktop browser.
The closest you could have is an iFrame surrounded by a picture of an iPhone, and instruct people to use Safari 5.
If you're on a Mac, you can use the iOS Simulator. Download Xcode from the App Store and with it comes the iOS Simulator, which also has the Safari app virtually exactly as is on the iPhone.
http://www.browserstack.com/ does exactly that. It ain't perfect, but it works..

HTML5 optimized for iPhone

I have a software that eventually will have some reports to be accessed via iPhone.
Once I am not willing to develop an iPhone app, I´d like to make these reports accessible via iPhone Safari browsers.
GMail in iPad uses HTML 5, so I guess I can do the same.
My question is where can I find some resources to learn best practices doing so and how can I test it in a PC computer.
Thanks
Here is a similar answer I've given: Exclusive CSS for iPhone/Android
For testing you can use Chrome or Safari, as they are both webkit browsers (which is what the iPhone uses). Safari can even render as the iPhone user agent.
Hope this helps.
Please take a look at PhoneGap, I think that is what you are looking for.
You can emulate the program in xCode, but you will need an Apple for that. For PhoneGap also..
From the app architecture view-point you should also consider introducing app-specific optimization such us:
Simplify the app (show only what you need for mobile)
Minimize Application and Data Size

Aggregate Images into a Single Composite Resource (Sprites)

Include Background Images Inline in CSS Style Sheets

Keep DOM Size Reasonable

Ensure Paragraph Text Flows

Avoid Redirects

How to build correctly Android-compatible website?

I am HTML/CSS/jQuery coder. And I need to develop the website, which will be "zoomed-out" or "fitted" to 320x480 (frequently used resolution) Android mobile device screen.
Or even this solutions should check my screen resolution and connect the right CSS for that.
Somewhere I met that there is android.js file, which connects to HTML and recognizes if the website was open on PC or on android device. But I am not sure at all. I didn't do anything for mobiles before.
Found this article: http://blog.mgpwr.co.uk/2010/09/make-your-website-iphone-compatible/
Don't think it's a right solution to use PHP for that.
Better would be HTML or JS.
A very simple answer would be don't hardcode width on the elements and don't specify font size in pixels. The mobile browser will adjust the rendered page itself.
If however you want more iPhone-like look of form controls like radio buttons, buttons, drop downs, then you need to use the mobile javascript libraries outlined in the other answer.
A simple answer would be a mobile javascript library such as one of the following:
http://www.sencha.com/products/touch/
http://www.phonegap.com/home/
http://jquerymobile.com/
http://jqtouch.com/

Why is iphone Simulator not rendering HTML5 page correctly?

I have a page I am developing in .net using HTML5 intended for a WebView in an iphone App. The page looks just fine in Safari. When I load it in the iphone Simulator it is rendering as plain text, no styles or js loading. I thought it might be an issue with .net, but seeing as it works in Safari i am stumped. When I use the XHTML doctype it works just fine in the Simulator. Any ideas why this is occurring and what the fix may be? Thanks!
Do you have problems rendering on the device? If not, don't worry about the Simulator, because it's not guaranteed to represent perfectly how the hardware works.
well it seems that the lovely .net mobile.browser file was setting the mime type for the simulator as xml. set it to xhtml and all is rosy.