-
Notifications
You must be signed in to change notification settings - Fork 378
Managing links and urls
Links in Baker can be divided in three distinct categories: internal, external and book.
Internal links target a single HTML file inside the book folder, for example:
<a href="new-page.html#anchor">Link to new page</a>
There are two different behaviors associated to internal links, based upon the type of the linked file:
- the file is a book page: Baker will scroll the book to the linked page and load its content. If the linked page is the current page, Baker will reload the page content.
- the file is not a book page: Baker will load the content of the linked file inside the current page, replacing its content with the new one.
If an #anchor
is specified, the content of the page will scroll down (or up) to the first element with an id
or name
attribute that matches the anchor.
External links target an external HTML page, for example:
<a href="http://www.external-site.com?referrer=Baker">Link to external site</a>
There are two different behaviors associated with external links, based upon the referrer
query parameter:
-
the
referrer
attribute is specified and it is equal toBaker
: Baker will open the linked page in the modal internal browser. -
the
referrer
attribute is specified and it is equal toSafari
: Baker will open the link directly in Safari Mobile. Please however be sure that this is really what you need to do, since it will create an inconvenience for most of the users. -
the
referrer
attribute is not specified or it is different fromBaker
orSafari
: Baker will load the content of the linked page inside the current page, replacing its content with the new one.
NOTE: the parameter is used in Baker and will not be used in the URL to contact the server. In the example above the server will receive only http://www.external-site.com
.
Baker supports the in-app sending of mails using mailto-links like the following ones:
<a href="mailto:[email protected]">Send mail</a>
<a href="mailto:[email protected]?subject=Hello%20World">Send mail with subject</a>
<a href="mailto:[email protected]?subject=Hello%20World&body=Foo%20Bar">Send mail with subject and body</a>
When one of these links is clicked, the app will open a modal sheet showing the standard iOS mail composer window.
Book links target an external book, for example:
<a href="book://www.mysite.com/books/new-book.hpub/page.html#anchor">Link to new book</a>
These links are defined by the special book://
protocol. When a book link is clicked, Baker will download and open the linked book, replacing the current one.
If page.html
is specified and it's a valid page of the new book, Baker will automatically open the new book at that page.
If an #anchor
is specified, the content of the page will scroll down (or up) to the first element with an id
or name
attribute that matches the anchor.
Other than standards book links, with the format described above, Baker supports a special book URL:
<a href="book://local">Link to bundle book</a>
When clicked in a book different than the bundled one, Baker will discard the current book and revert to the original one.