Call native application iOS in iPad from html link in Baker
I'm trying to make a social media share link in some of my HTML pages in Baker, so that if user would like to, they can click the share button , and share the page or a text link to their social media account.
i know Baker support the 'refferer=Baker' to open browser modal inside the book that can be implemented like "http://twitter.com/share?text=TestShareLink%20referrerBAKER&url=http://www.mysite.com/referrer=Baker"
but in my case, the social media should opened by calling the native application in user device. so the anchor link will be like "twitter://post?message=testSHARE%20link%20%23testNativeAPP"
and if Wors case:the user doesn't have the application like Facebook,twitter inside the device, an alert will appear and tell user should download the application first, or redirect it to app store could it be possible ?
I'd really be interested in an answer to this to. In case previous poster's English skills didn't make him understood, here's what he wants to know: is there a way, in a Baker ebook, to make a link that opens the Twitter or Facebook apps on iOS, instead of a WebUI browser window?
In these regards, Baker should behave like Mobile Safari: if the application, in this case Twitter or Facebook, supports an external protocol, it should be opening. Doing any fallback, should be similarly handled as you would do in Mobile Safari.
The best way is really to test. I checked the code the syntax to do that is in the source, so should work, but I haven't tested. If the direct twitter:// protocol doesn't work, then it could be a bug.
Hello, I created a test page http://wph7.ru/twitter.html and tried it in mobile safari. It works. When I clicked URL my twitter app started on iPad. I used twitter:// scheme. Can you try to add to your issue link like this twitter://post?message=hello%20world
I tried just a simple Twitter test message in a page, like so:
Tweet this
Absolutely nothing happens when that link is clicked. Is that a bug, or am I just not testing right? (I'm VERY new to all this)
On Tue, May 7, 2013 at 3:13 PM, Davide Casali [email protected]:
In these regards, Baker should behave like Mobile Safari: if the application, in this case Twitter or Facebook, supports an external protocol, it should be opening. Doing any fallback, should be similarly handled as you would do in Mobile Safari.
The best way is really to test. I checked the code the syntax to do that is in the source, so should work, but I haven't tested. If the direct twitter:// protocol doesn't work, then it could be a bug.
— Reply to this email directly or view it on GitHubhttps://github.com/Simbul/baker/issues/862#issuecomment-17563550 .
John Brownlee writer, blogger, journowhatsit ph: +1 212 464 7719 em: [email protected]
Okay, I took that EXACT code (which works in a standard HTML preview on my Mac of the underlying source) and Baker doesn't do anything when you click on it. Looks like a bug to me.
On Tue, May 7, 2013 at 3:29 PM, bober80 [email protected] wrote:
Hello, I created a test page http://wph7.ru/twitter.html and tried it in mobile safari. It works. When I clicked URL my twitter app started on iPad. I used twitter:// scheme. Can you try to add to your issue link like this twitter://post?message=hello%20world
— Reply to this email directly or view it on GitHubhttps://github.com/Simbul/baker/issues/862#issuecomment-17564612 .
John Brownlee writer, blogger, journowhatsit ph: +1 212 464 7719 em: [email protected]
It would be great to get this fixed, since right now, this is the only way to really share articles on Twitter and Facebook through Baker, which is integral for promotion.
On Tue, May 7, 2013 at 3:40 PM, John Brownlee [email protected]:
Okay, I took that EXACT code (which works in a standard HTML preview on my Mac of the underlying source) and Baker doesn't do anything when you click on it. Looks like a bug to me.
On Tue, May 7, 2013 at 3:29 PM, bober80 [email protected] wrote:
Hello, I created a test page http://wph7.ru/twitter.html and tried it in mobile safari. It works. When I clicked URL my twitter app started on iPad. I used twitter:// scheme. Can you try to add to your issue link like this twitter://post?message=hello%20world
— Reply to this email directly or view it on GitHubhttps://github.com/Simbul/baker/issues/862#issuecomment-17564612 .
John Brownlee writer, blogger, journowhatsit ph: +1 212 464 7719 em: [email protected]
John Brownlee writer, blogger, journowhatsit ph: +1 212 464 7719 em: [email protected]
Yes I added a link like yours twitter:// to my issue but it doesn't work in Baker. Nothing is happened when I clicked a link
Sorry if it's a stupid question, but I couldn't find confirmation of this in your posts: have you tried the same link in Safari Mobile? Does it work there?
Yes, it works in mobile safari. You can try http://wph7.ru/twitter.html it is simple HTML page wich has only one link twitter://post?message=hello%20world
I just tried it with the latest master and it works just fine. Another dumb question: are you sure the Twitter application is installed on the device? I tested on the simulator in the beginning and it took me a minute to realise there's no Twitter on that :D
Yes I have installed app twitter on my iPad and it works when I click on link in mobile safari. But it doesn't work in my iPad when I use Baker but I have very old version of baker on my iPad (3.2 if I'm not mistaken). I tried on iPad and I didn't try on the simulator
Ok. :) Check the newly released version 4.1 and let us know. :)
Davide, I'm sorry if I sound like a fool, but I have the 4.1 version downloaded from the main Baker page. Is there a direct link you could provide to the latest version?
That's it. It should work. :)
Davide, I'm testing the latest version now. Sadly, this doesn't work there either. Don't suppose there's an alternative?
Unfortunately no. Could you post here your console log and the HTML you are using? :)
Okay, the code is very simple. I have a single link in a Baker page that says:
<a href="twitter://post?message=hello%20world">Share On Twitter</a>
That SHOULD open iOS's Twitter app, or prompt to install it, right?
But instead, nothing happens at all. It's as if the link isn't even clicked. (No other link responds in this fashion within Baker)
Here's the log. All I'm doing here is running Baker (freshly cleaned, in reset iOS simulator), downloading my latest issue, opening it, navigating to the page and clicking the "Share On Twitter" link. As you can see, clicking the link doesn't generate an error at the end or anything.
*2013-05-12 20:21:29.499 Baker[35403:c07] ====== Baker Newsstand Mode
enabled ======*
*2013-05-12 20:21:29.710 Baker[35403:c07] [BakerShelf] Newsstand - Added
Cult 2013-03-20 15:18:00 +0000*
*2013-05-12 20:21:29.711 Baker[35403:c07] [BakerShelf] Newsstand - Added
Cult 2 2013-03-26 15:18:00 +0000*
*2013-05-12 20:21:29.711 Baker[35403:c07] [BakerShelf] Newsstand - Added
Cult 3 2013-03-26 16:18:00 +0000*
*2013-05-12 20:21:29.712 Baker[35403:c07] [BakerShelf] Newsstand - Added
Cult Of Mac Magazine 2013-04-30 16:18:00 +0000*
*2013-05-12 20:21:29.782 Baker[35403:c07] [AppDelegate] Push Notification -
Device Token, review: Error Domain=NSCocoaErrorDomain Code=3010 "remote
notifications are not supported in the simulator" UserInfo=0x9578e60
{NSLocalizedDescription=remote notifications are not supported in the
simulator}*
*2013-05-12 20:21:34.011 Baker[35403:c07] ############ REQUEST RECEIVED
RESPONSE (*
*)*
*2013-05-12 20:21:34.012 Baker[35403:c07] Invalid product identifier:
com.freesubscription*
*2013-05-12 20:21:41.793 Baker[35403:c07] [BakerShelf] 'Cult Of Mac
Magazine' is Connecting...*
*2013-05-12 20:21:42.583 Baker[35403:c07] [BakerShelf] 'Cult Of Mac
Magazine' is Downloading...*
*2013-05-12 20:22:08.251 Baker[35403:c07] [BakerShelf] Newsstand - File is
being unzipped to /Users/brownlee/Library/Application Support/iPhone
Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/Newsstand/48D71816-D3B9-4911-887F-CFE2480D9CFF
*
*2013-05-12 20:22:08.527 Baker[35403:c07] [BakerShelf] 'Cult Of Mac
Magazine' is Ready to be Read.*
*2013-05-12 20:22:26.078 Baker[35403:c07] [BakerBook] 'book.json' parsed
successfully. Book 'Cult Of Mac #1: The iWatch Cometh' created with id
'cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc'.*
*2013-05-12 20:22:26.079 Baker[35403:c07] [BakerView] Init book view...*
*2013-05-12 20:22:26.079 Baker[35403:c07] [BakerView] Device Screen
(WxH): 768.000000x1024.000000.*
*2013-05-12 20:22:26.080 Baker[35403:c07] [BakerView] Status: page
(null) @ scrollIndex (null)px.*
*2013-05-12 20:22:26.080 Baker[35403:c07] [BakerView] Loading book from
path: /Users/brownlee/Library/Application Support/iPhone
Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/Newsstand/48D71816-D3B9-4911-887F-CFE2480D9CFF
*
*2013-05-12 20:22:26.080 Baker[35403:c07] [BakerView] Pages in this
book: 6*
*2013-05-12 20:22:26.081 Baker[35403:c07] [BakerView] Screenshots stored
at: /Users/brownlee/Library/Application Support/iPhone
Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/screenshots/cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc
*
*2013-05-12 20:22:26.445 Baker[35403:c07] [BakerView] Set size for
orientation: portrait*
*2013-05-12 20:22:26.451 Baker[35403:c07] [IndexView] Set IndexView size to
768x1024*
*2013-05-12 20:22:26.463 Baker[35403:c07] [BakerView] Loading: cover.html*
*2013-05-12 20:22:26.464 Baker[35403:c07] [IndexView] Set IndexView size to
768x1024*
*2013-05-12 20:22:26.484 Baker[35403:c07] [BakerView] Set size for
orientation: portrait*
*2013-05-12 20:22:26.485 Baker[35403:c07] [IndexView] Set IndexView size to
768x1024*
*2013-05-12 20:22:26.549 Baker[35403:c07] [IndexView] Set size for
IndexView to 768x223 (constrained from 2008x223)*
*2013-05-12 20:22:26.781 Baker[35403:c07] [BakerView] Screenshot
succesfully saved to file /Users/brownlee/Library/Application
Support/iPhone
Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/screenshots/cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc/screenshot-portrait-1.jpg
*
*2013-05-12 20:22:29.163 Baker[35403:c07] [BakerView] Toggle bars visibility
*
*2013-05-12 20:22:30.672 Baker[35403:c07] [BakerView] Page is a link
with scheme file:// --> load internal link*
*2013-05-12 20:22:31.176 Baker[35403:c07] [BakerView] Loading: index1.html*
*2013-05-12 20:22:31.328 Baker[35403:c07] [BakerView] Screenshot
succesfully saved to file /Users/brownlee/Library/Application
Support/iPhone
Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/screenshots/cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc/screenshot-portrait-2.jpg
Any ideas? If not, any idea how I can share stuff on Thanks again for all of your help and fantastic work.
I repost your message because GitHub is having problems interpreting the reply done via email:
@DrCrypt said: Okay, the code is very simple. I have a single link in a Baker page that says:
<a href="twitter://post?message=hello%20world">Share On Twitter</a>
That SHOULD open iOS's Twitter app, or prompt to install it, right?
But instead, nothing happens at all. It's as if the link isn't even clicked. (No other link responds in this fashion within Baker)
Here's the log. All I'm doing here is running Baker (freshly cleaned, in reset iOS simulator), downloading my latest issue, opening it, navigating to the page and clicking the "Share On Twitter" link. As you can see, clicking the link doesn't generate an error at the end or anything.
2013-05-12 20:21:29.499 Baker[35403:c07] ====== Baker Newsstand Mode enabled ======
2013-05-12 20:21:29.710 Baker[35403:c07] [BakerShelf] Newsstand - Added Cult 2013-03-20 15:18:00 +0000
2013-05-12 20:21:29.711 Baker[35403:c07] [BakerShelf] Newsstand - Added Cult 2 2013-03-26 15:18:00 +0000
2013-05-12 20:21:29.711 Baker[35403:c07] [BakerShelf] Newsstand - Added Cult 3 2013-03-26 16:18:00 +0000
2013-05-12 20:21:29.712 Baker[35403:c07] [BakerShelf] Newsstand - Added Cult Of Mac Magazine 2013-04-30 16:18:00 +0000
2013-05-12 20:21:29.782 Baker[35403:c07] [AppDelegate] Push Notification - Device Token, review: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x9578e60 {NSLocalizedDescription=remote notifications are not supported in the simulator}
2013-05-12 20:21:34.011 Baker[35403:c07] ############ REQUEST RECEIVED RESPONSE ( )
2013-05-12 20:21:34.012 Baker[35403:c07] Invalid product identifier: com.freesubscription
2013-05-12 20:21:41.793 Baker[35403:c07] [BakerShelf] 'Cult Of Mac Magazine' is Connecting...
2013-05-12 20:21:42.583 Baker[35403:c07] [BakerShelf] 'Cult Of Mac Magazine' is Downloading...
2013-05-12 20:22:08.251 Baker[35403:c07] [BakerShelf] Newsstand - File is being unzipped to /Users/brownlee/Library/Application Support/iPhone Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/Newsstand/48D71816-D3B9-4911-887F-CFE2480D9CFF
2013-05-12 20:22:08.527 Baker[35403:c07] [BakerShelf] 'Cult Of Mac Magazine' is Ready to be Read.
2013-05-12 20:22:26.078 Baker[35403:c07] [BakerBook] 'book.json' parsed successfully. Book 'Cult Of Mac #1: The iWatch Cometh' created with id 'cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc'.
2013-05-12 20:22:26.079 Baker[35403:c07] [BakerView] Init book view...
2013-05-12 20:22:26.079 Baker[35403:c07] [BakerView] Device Screen (WxH): 768.000000x1024.000000.
2013-05-12 20:22:26.080 Baker[35403:c07] [BakerView] Status: page (null) @ scrollIndex (null)px.
2013-05-12 20:22:26.080 Baker[35403:c07] [BakerView] Loading book from path: /Users/brownlee/Library/Application Support/iPhone Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/Newsstand/48D71816-D3B9-4911-887F-CFE2480D9CFF
2013-05-12 20:22:26.080 Baker[35403:c07] [BakerView] Pages in this book: 6
2013-05-12 20:22:26.081 Baker[35403:c07] [BakerView] Screenshots stored at: /Users/brownlee/Library/Application Support/iPhone Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/screenshots/cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc
2013-05-12 20:22:26.445 Baker[35403:c07] [BakerView] Set size for orientation: portrait
2013-05-12 20:22:26.451 Baker[35403:c07] [IndexView] Set IndexView size to 768x1024
2013-05-12 20:22:26.463 Baker[35403:c07] [BakerView] Loading: cover.html
2013-05-12 20:22:26.464 Baker[35403:c07] [IndexView] Set IndexView size to 768x1024
2013-05-12 20:22:26.484 Baker[35403:c07] [BakerView] Set size for orientation: portrait
2013-05-12 20:22:26.485 Baker[35403:c07] [IndexView] Set IndexView size to 768x1024
2013-05-12 20:22:26.549 Baker[35403:c07] [IndexView] Set size for IndexView to 768x223 (constrained from 2008x223)
2013-05-12 20:22:26.781 Baker[35403:c07] [BakerView] Screenshot succesfully saved to file /Users/brownlee/Library/Application Support/iPhone Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/screenshots/cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc/screenshot-portrait-1.jpg
2013-05-12 20:22:29.163 Baker[35403:c07] [BakerView] Toggle bars visibility
2013-05-12 20:22:30.672 Baker[35403:c07] [BakerView] Page is a link with scheme file:// --> load internal link
2013-05-12 20:22:31.176 Baker[35403:c07] [BakerView] Loading: index1.html
2013-05-12 20:22:31.328 Baker[35403:c07] [BakerView] Screenshot succesfully saved to file /Users/brownlee/Library/Application Support/iPhone Simulator/6.1/Applications/44ABA679-ACE1-414C-A03E-1776B2B8CEB0/Library/Caches/screenshots/cult-of-mac-1-the-iwatch-cometh-ddbb8e693f1dc/screenshot-portrait-2.jpg
Any ideas? If not, any idea how I can share stuff on
Thanks again for all of your help and fantastic work.
We tried again and in our test it works. We put up a test shelf.json so we can cross-check the code. Try using:
http://bakerframework.com/demo/dev/shelf.json as your shelf, download the "Baker Dev Tests" book and try using the link.
That SHOULD open iOS's Twitter app, or prompt to install it, right?
I don't think it will prompt you to install it.
Have a go at it after downloading the latest master. I've added a more informative error message in 025fa13.