Way to construct urls to open in Gospel Library app?
-
jakehadley10
- New Member
- Posts: 2
- Joined: Fri Sep 04, 2020 1:20 pm
Way to construct urls to open in Gospel Library app?
I'm developing an app related to the Book of Mormon that will have references to scriptures. I want to be able to click on a link and open the particular scripture in the gospel library app. I can do this in the format of `Alma 3:2-3`, but when I get into multiple sets of ranges of verses, it will open the browser instead of gospel library. `Alma 3:2-3, 5-16`. How can I construct a url to open this in the gospel library app?
-
sbradshaw
- Community Moderators
- Posts: 6711
- Joined: Mon Sep 26, 2011 9:42 pm
- Location: Utah
Re: Way to construct urls to open in Gospel Library app?
The current preferred way is to use a "universal link" that works in both a web browser and the app, like this:
https://www.churchofjesuschrist.org/stu ... ang=eng#p2
Using a universal link allows the user to choose if they want to use the site or app, and it provides a good experience if the link is tapped/clicked on a device that doesn't have Gospel Library installed. It works for Android and iOS Gospel Library (I'm not sure about Windows Gospel Library – but if not, it will fall back to the browser).
If you want to force the link to open in the Gospel Library app only, you can use this older format (it will fail if the app isn't installed):
[url]gospellibrary://content/scriptures/bofm/alma/3.2-3,5-16#2[/url]
https://www.churchofjesuschrist.org/stu ... ang=eng#p2
Using a universal link allows the user to choose if they want to use the site or app, and it provides a good experience if the link is tapped/clicked on a device that doesn't have Gospel Library installed. It works for Android and iOS Gospel Library (I'm not sure about Windows Gospel Library – but if not, it will fall back to the browser).
If you want to force the link to open in the Gospel Library app only, you can use this older format (it will fail if the app isn't installed):
[url]gospellibrary://content/scriptures/bofm/alma/3.2-3,5-16#2[/url]
Samuel Bradshaw • If you desire to serve God, you are called to the work.
-
jakehadley10
- New Member
- Posts: 2
- Joined: Fri Sep 04, 2020 1:20 pm
Re: Way to construct urls to open in Gospel Library app?
@sbradshaw Awesome, this is exactly what I was looking for. I didn't know the right way to construct the arguments for the url. Is there any documentation around the url? I've seen another argument on the end sometimes: <url>lang=eng#p2#2
That extra #2 was what I wasn't sure about. I just wanted to make sure there wasn't anything else that I was missing. The example you gave should definitely be sufficient for our needs but I was just curious.
That extra #2 was what I wasn't sure about. I just wanted to make sure there wasn't anything else that I was missing. The example you gave should definitely be sufficient for our needs but I was just curious.
-
sbradshaw
- Community Moderators
- Posts: 6711
- Joined: Mon Sep 26, 2011 9:42 pm
- Location: Utah
Re: Way to construct urls to open in Gospel Library app?
There isn't documentation online anywhere, unfortunately... I think #p2#2 is a bug (most likely the browser will ignore the second hash symbol and everything that follows it).
The "id" parameter indicates which paragraph(s) or heading(s) to call out on the page with a bar in the left margin. You can get the IDs for paragraphs by looking for "id" attributes on the HTML elements in a web inspector. If the id parameter is left off, nothing will be called out on the page.
The "lang" parameter indicates which language of content to go to. If the lang parameter is left off, the link will open in the browser language (web) or current content language (app).
The "#" indicates where on the page to jump / scroll to, after it loads. Usually this is the first paragraph that's called out with a bar, but it doesn't necessarily have to be. If the # is left off, the page will load scrolled to the top.
The same URL pattern should work for all content under https://www.churchofjesuschrist.org/study.
The "id" parameter indicates which paragraph(s) or heading(s) to call out on the page with a bar in the left margin. You can get the IDs for paragraphs by looking for "id" attributes on the HTML elements in a web inspector. If the id parameter is left off, nothing will be called out on the page.
The "lang" parameter indicates which language of content to go to. If the lang parameter is left off, the link will open in the browser language (web) or current content language (app).
The "#" indicates where on the page to jump / scroll to, after it loads. Usually this is the first paragraph that's called out with a bar, but it doesn't necessarily have to be. If the # is left off, the page will load scrolled to the top.
The same URL pattern should work for all content under https://www.churchofjesuschrist.org/study.
Samuel Bradshaw • If you desire to serve God, you are called to the work.