How do I add target=”_blank” to a link within a specified div?

/* here are two different ways to do this */ //using jquery: $(document).ready(function(){ $(‘#link_other a’).attr(‘target’, ‘_blank’); }); // not using jquery window.onload = function(){ var anchors = document.getElementById(‘link_other’).getElementsByTagName(‘a’); for (var i=0; i<anchors.length; i++){ anchors[i].setAttribute(‘target’, ‘_blank’); } } // jquery is prettier. 🙂 You could also add a title tag to notify the user that you … Read more

PhoneGap for iPhone: problem loading external URL

I think I’ve found the solution, in the PhoneGap Application Delegate .m file {YourProject}AppDelegate.m, modify the method: – (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; } with – (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = [request URL]; if ([[url scheme] isEqualToString:@”http”] || [[url scheme] isEqualToString:@”https”]) { return YES; } … Read more