Discussion Forums  >  WebViews and HTML for Mobile

Replies: 6    Views: 214

perrytheweaver
Apple Fan
Profile
Posts: 51
Reg: Jun 14, 2011
Rowlett, TX
3,460
01/25/13 02:57 PM (11 years ago)

Link in html should open Safari

I have some html I pull from a remote server to load into a BT page. Within that html is a standard <a href> link. When clicking that link within the finished app, that link should open in Safari, not the app itself. To be clear, the "Launch Native App" plugin won't work there, because the html link itself resides within the html the SERVER generates and is loaded into app page. I found an answer to this a couple of years ago, using some extra coding in the AppDelegate.m (Xcode) file. But that does not seem to work now. Ideas? Thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/25/13 03:41 PM (11 years ago)
I haven't tried; I'm just guessing... what happens if you link it sort of like this: <a href="http://www.server.com/externallink.html" target="_new">Maybe this works?</a> Cheers! -- Smug (Edit: I have the feeling I may have read this wrong originally... You have an app with a webview. On this webview is a page with a link. You want this link to launch safari, not a navigation from the linked page. This page sits on another server? Is it a server that you control and have access to?)
 
perrytheweaver
Apple Fan
Profile
Posts: 51
Reg: Jun 14, 2011
Rowlett, TX
3,460
like
01/25/13 03:47 PM (11 years ago)
Correct on all points, Smug!
 
perrytheweaver
Apple Fan
Profile
Posts: 51
Reg: Jun 14, 2011
Rowlett, TX
3,460
like
01/25/13 03:48 PM (11 years ago)
So far target="_new" or target="_blank" is not working.
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
01/26/13 12:07 AM (11 years ago)
If its a html doc check under advanced properties, pretty sure theres a setting that detects different links to ignore or make active, not positive though. But look under document behavior.
 
perrytheweaver
Apple Fan
Profile
Posts: 51
Reg: Jun 14, 2011
Rowlett, TX
3,460
like
01/26/13 12:26 PM (11 years ago)
The advanced properties will allow you to open the retrieved html page itself in a browser; but I want to view the html page in the app, and any links in the page would open a browser. Finally found the answer, I think. Needed to modify this plugin to open particular links in Safari: /BT_Plugins/bt_screen_customURL/BT_screen_customURL.m In there I can modify the webView routine which scans the URLs of any links clicked on; when a link URL matches a particular domain (like twitter.com), I can open Safari, or at least give the user the option of opening it.
 
hannekemeier
Apple Fan
Profile
Posts: 40
Reg: Mar 11, 2013
Eersel
400
like
03/19/13 01:47 AM (11 years ago)
Hi @perrytheweaver, could you describe where and what you have to modify to open a link in Safari?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.