TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Mobile development with HTML5

90 点作者 ubi超过 13 年前

6 条评论

dreamdu5t超过 13 年前
Real-world web-app development is much different than the ideal of HTML5.<p>jQuery? Just including that puts your mobile web-app at 86KB of JavaScript and you haven't even written a single line of your app's code. Rendering on the client-side with jQuery templates is not anywhere near practical for the majority of web-enabled phones – if not all of them except the iPhone. More than 100-150KB of JS and most phones will enter sluggish territory.<p>Something you'll notice reading about HTML5 is most books and online articles are written by people who have never built or released web-app to be run on phones less powerful than an iPhone 4. They picked up an HTML5 book and regurgitated everything and every new nifty feature into their own words and examples.<p>My advice?<p>Don't use jQuery or any framework. Use native JS and only the functions you need, don't use CSS3, keep the DOM structure as simple as possible, and test from day one. My entire web-app's JS is 60KB minified, because I don't rely on framework's like jQuery (86KB) or Sencha Touch (250KB). These sizes don't matter on a desktop computer, but on an HTC from last year running Android 2.3, size greatly affects performance.
评论 #2927098 未加载
评论 #2928112 未加载
评论 #2927361 未加载
评论 #2928283 未加载
评论 #2927521 未加载
评论 #2927486 未加载
评论 #2927209 未加载
评论 #2927874 未加载
jbail超过 13 年前
Nice overview.<p>One note of caution: Rendering on the client side using jQuery Templates as the author suggests is great for small amounts of content, but even a list with 40 items will nearly freeze the UI while its rendered. I've experienced this on both iPhone and Android.<p>Also, using a cache manifest will cache your AJAX/JSONP calls. Either explicitly list these URLs in the network section of your manifest or add a timestamp to each request so its unique.
评论 #2927812 未加载
keeperofdakeys超过 13 年前
I recently visited a site from HN on my phone, but its text was a bit too small for me to read, so I tried zooming in. To my surprise, it didn't zoom at all! From this article, the website must have set user-scalable=no.<p>I don't really see the point of this option. The website can (presumably) scale to many different devices already, surely it can then scale with zooming as well. I'd think you could use percentages to create any kind of 'static' ui, if you really wished to do so.
评论 #2927304 未加载
评论 #2927661 未加载
评论 #2927305 未加载
andybak超过 13 年前
"user-scalable=no".<p>Is this really the way forward? Why the assumption that the only reason I might zoom in is 'accidental'?<p>Also I am uneasy about populating all content via JSON but I can't put my finger on the precise technical reasons (but then neither could Gawker wrt desktop browsers so they went ahead with it anyway)
saurik超过 13 年前
I use the HTML5 app cache. I have tens of millions of users on this in-production product. I only really feel safe doing this because I have a custom web browser, and as I only target jailbroken devices I can hack at WebKit a little to make this work.<p>When I started using it, it seemed awesome. Then I played with it a little, and it started failing. Given that I have friends who actually give talks at conferences on the HTML5 application cache and how cool it was, this didn't make any sense: I believed I must be doing it wrong.<p>Then, one day, I decided to read the source code for WebKit's implementation of the HTML5 application cache, and found it to have tons of race conditions that would lead to whole-browser crash conditions (which I was even experiencing in my app). I even found a bug on the bug tracker with my most-occurred bug on it.<p><a href="https://bugs.webkit.org/show_bug.cgi?id=43506" rel="nofollow">https://bugs.webkit.org/show_bug.cgi?id=43506</a><p>Only, that bug had been filed only months before, and this feature of WebKit had been "in production", with these bugs, for a couple years. My only guess is that no one really uses this feature very often.<p>Reading into the bug tracker some (to find more bugs), staring at the commit messages for the previous year, and even reading some of the posts on the mailing list, I found choice quotes from the people maintaining it that explained that no one knew how this code works, and that the one guy who did forgot.<p>In iOS 4.3 (I believe it was only 4.3, not 4.2, but I'd sort of believe 4.2, /maybe/ even 4.1), the crash bugs have been "fixed" (or I'd have given them to comex to maybe build another jailbreakme.com), but the race conditions remain: the code doesn't actually /work/, it just sort of doesn't fail.<p>Specifically, the issue is that the application cache loader for a page is tied to a specific frame: the one that started loading the cache. If that frame is freed, such as by the simple act of the user hitting the reload button, while the download is occurring, the entire thing gets wedged, and you can no longer get any parts of your page cached, nor can you recover or fix the process without the user totally closing the web browser and reopening it.<p>In practice, this actually happens constantly: if the user has a reasonably slow connection, and things are taking a while in the background to cache, they will hit reload. This deletes the old frame, but associates a new frame with the same cache builder. When the current download stops, the frame it was using is gone, and it ends up in this horrible wedge state.<p>Ok, I no longer even remember why I'm bothering to type this here (does anyone care? does anyone actually intend to try to use this feature? ;P), but I also no longer seem to have anything more to say, so I'm going to click "add comment" ;P.
评论 #2928251 未加载
评论 #2928784 未加载
评论 #2928254 未加载
warmfuzzyapps超过 13 年前
In addition to powering full blown web apps, web technologies can also be used from within web views to create hybrid native/web apps.<p>I have a post on idevblogaday.com today on calling Objective-C from JavaScript, calling JavaScript from Objective-C, and logging to the Xcode console from JavaScript.