*Hack warning*: This is not an elegant or nice solution, so feel free to berate me for damage to your eyes 🙂
If you are using PhoneGap with iPhone, then you have noticed that external urls don’t open unless you modify
shouldStartLoadWithRequest, This works fine with http:// and https:// urls, but I’ve noticed that it didn’t work with tel: or mailto: links. Despite millions of posts on the internet saying it ‘should’ work. I found a horrible hack that avoids this problem, by creating a HTML page on my server, with the content:
Which, very simply, means that you can send a user to http://yourserver.com/link.html?url=mailto:email@example.com – sending the user to safari, then the mail client immediately afterwards.
Feel free to throw up your lunch now.
This is just a personal experience, so if this destroys your house or eats your dog, then don’t blame me.
If you run a DBCC CheckDB on your SQL server database, and get an error such as
Incorrect PFS free space information for page (1:7394) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 0_PCT_FULL, actual value 100_PCT_FULL.
Then, you can repair this error using
ALTER DATABASE xxxxx
SET single_user WITH ROLLBACK IMMEDIATE;
DBCC checkdb (‘xxxx’, repair_allow_data_loss);
What this command does, is delete any erroneous pages, which removes the error, but will also delete any data contained in the erroneous pages. If the affected data can be sacrificed, then you can use this to recover the rest of the database.
A battle I’ve often fought is the vertical scroll in Phonegap. iOS sees the app as a browser window (UIWebView), and wants to treat it as such, and your clients and users see it as a static app, with fixed navigation elements ontop of scrollable content.
On pages where the content does not need to be scrolled at all then you just need to call preventDefault on touchmove event.
document.addEventListener(‘touchmove’, function (e)
Note, that I have used a function call to “IsDraggablePage”, this method can be used to selectively decide if the page can be scrolled or not. Typically, a page where all the content fits without scrolling, then you can disable scrolling, if the content doesn’t, or may not always fit, then you should enable scrolling.
This function, isDraggablePage, checks an attribute “draggable” of the page, and if it is set to true, then the page can be dragged.
All well and good, until you hit this problem, on a page that needs to be draggable, it appears that the navigation bars can be dragged out of place
Scroll to webViewDidFinishLoad, and enter the following line of code before the return statement:
[[theWebView.subviews objectAtIndex:0] setBounces:NO];
This means that, when you scroll beyond the bounds of the UIWebView, it will not bounce back to position, it will just stop suddenly, leaving your navigation in place.
If you are developing apps for BlackBerry using PhoneGap / Webworks for Blackberry, then you have probably noticed that if you add a url to an external website, such as <a href=”http://www.google.com”>Google</a>, then the destination website gets loaded within the frame of the app, giving a poor user experience, and no way to return to the app, apart from closing the app.
The solution is not obvious, since you have to use Webworks API (which is not cross-platform, it’s BlackBerry only).
use the following code when itializing JQuery
$(‘a[target=”_blank”]’).live( ‘click’, function()
if ( window.blackberry )
alert( ‘Loading website: ‘ + $(this).attr( ‘href’ ) );
var args = new blackberry.invoke.BrowserArguments( $(this).attr( ‘href’ ));
Then IMPORTANTLY add the following lines to the config.xml
<feature id=”blackberry.app” required=”true” version=”126.96.36.199″/>
<feature id=”blackberry.invoke.BrowserArguments” />
<access uri =”*”/>
I have heard that this invocation mechanism may change for BlackBerry 10 / Playbook, which I am going to test soon.