This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 0. Override these in your MainViewController.m | |
| // 1. your .startPage is http://www.google.com for example, set in your AppDelegate.m | |
| // 2. don't forget to add that url in your whitelist | |
| static BOOL isExternalUrlHack = NO; | |
| - (NSString*) pathForResource:(NSString*)resourcepath; | |
| { | |
| if ([self.startPage isEqualToString:resourcepath] && [self.startPage hasPrefix:@"http://"]) { | |
| isExternalUrlHack = YES; | |
| // return non-nil so it doesn't fail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var dm = {}; | |
| function msg_delay(e, m) | |
| { | |
| if (!m) { m = e; } | |
| dm[e] = m; | |
| } | |
| function msg(m, d) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function testOld(p) { | |
| var result = p.timestamp || new Date(); | |
| console.log("\told: " + result); | |
| } | |
| function testNew(p) { | |
| var result = (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))); | |
| console.log("\tnew: " + result); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title></title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> | |
| <meta charset="utf-8"> | |
| <!-- iPad/iPhone specific css below, add after your main css > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.addEventListener("deviceready", onDeviceReady,false); | |
| function setFolderMetadata(localFileSystem, subFolder, metadataKey, metadataValue) | |
| { | |
| var onSetMetadataWin = function() { | |
| console.log("success setting metadata") | |
| } | |
| var onSetMetadataFail = function() { | |
| console.log("error setting metadata") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Fundamentally, this is a WebKit bug that cannot be worked around currently (it does not release memory of images that a not used anymore). I did extensive measurements by loading huge images in a previous project, and it consistently crashes because of this bug. | |
| I believe it has been reported to the WebKit project, with no resolution: | |
| https://bugs.webkit.org/show_bug.cgi?id=31253 | |
| https://bugs.webkit.org/show_bug.cgi?id=39628 | |
| Usually, setting the image src to null I think would flag the gc to recycle the memory, but I don't think it will work because of this bug. | |
| Others have the same problem, from the Apple Dev Forums (login needed): | |
| https://devforums.apple.com/search.jspa?resultTypes=MESSAGE&q=UIWebView+memory&peopleEnabled=true&start=1&dateRange=all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while :; do curl https://issues.apache.org/jira 2>/dev/null | (grep "Maintenance in progress" || say "The Apache Jeera Site is back online.") | grep -v "<h1>Maintenance in progress</h1>"; sleep 300; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <meta name="format-detection" content="telephone=no" /> | |
| <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" /> | |
| <title>Hello World</title> | |
| <script type="text/javascript" src="cordova-2.1.0rc1.js"></script> | |
| <script type="text/javascript"> | |
| document.addEventListener("deviceready", onDeviceReady, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| if (typeof String.prototype.startsWith != 'function') { | |
| String.prototype.startsWith = function (str){ | |
| return this.slice(0, str.length) == str; | |
| }; | |
| } | |
| function launchUrl() { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.addEventListener("deviceready", onDeviceReady, false); | |
| // Cordova is ready to be used! | |
| // | |
| function onDeviceReady() { | |
| // do stuff here | |
| var exec = cordova.require('cordova/exec'); | |
| exec.setJsToNativeBridgeMode(exec.jsToNativeModes.IFRAME_NAV); | |
| } |