Now to the fun part. The URL to open a book in in Books looks like this ibooks://assetid/451454820
Simple enough, and it works. But (the big but): you have to know the asset id. Two ways for that
If the title is avaiable in the iTunes store, the asset ID is part of its link (says the net, I didn’t check)
Books seems to have an asset ID for all books you throw at it. So you only have to figure that one out …
Easy-peasy. Open terminal, do a cd ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary
You’ll see a file named BKLibrary-xxxx.sqlite. I suppose the xxxx part is different for everyone. Next, do a sqlite BKLibrary-xxxx.sqlite
That gives you the sqlite> prompt, at which you enter select ztitle, zassetid from zbklibraryasset;
(yes, the semicolon at the end is required)
And voilà, there’s the list of your book titles with the corresponding asset id.
Still at the sqlite> prompt, type Ctrl-C to exit sqlite.
This procedure is harmless, but still… WARNING: Follow these steps only if you know what you’re doing. Don’t stray from the path and have a copy of the BKLibrary file stored at a save place. If anything goes awry, restore this copy. As an added precaution, close Books before you meddle with the sqlite file.
Linking to a specific part of a different book is only supported for non-EPUB format books created with iBooks Author.
When I open an ePub by its iBooks URL the item is opened to the last viewed page. I do not know how this works but it is interesting.
I can see some value in creating a service that would simplify finding the asset id from an ePub item in iBooks. It is too bad that the asset id can not be added to the list view columns. Since deep linking ePubs can’t be done, I am not sure how useful linking to them in iBooks would be.