Article anchors

50 views
Skip to first unread message

Nathan Do

unread,
Jan 20, 2013, 3:15:46 AM1/20/13
to trees...@googlegroups.com
Hi guys, 

While reading the code, I ve come to notice that article anchor are hashes appended to the original url.  #anchor
Using treesaver, how can we set anchors for an article ? Is that possible at all ? 

Thank you, 
Nathan

Mark Kessler

unread,
Nov 14, 2013, 10:20:13 AM11/14/13
to trees...@googlegroups.com
You probably won't need this information anymore but I run into the same question and got some result that I want to share. Though it didn't work to address a specific article by opening that url directly in a browser, I found that you can address a specific article by using the method "goToDocumentByURL" of the treesaver framework with an url following the patter:

var url = protocol + domain + path + filename + '#' + articleId;

e.g.


the method "goToDocumentByURL" is exposed as "treesaver.goToDocumentByURL" and can be called anywhere in your code with JavaScript like this:

treesaver.goToDocumentByURL(url);

Mark Kessler

unread,
Nov 14, 2013, 10:21:28 AM11/14/13
to trees...@googlegroups.com
One more thing: you have to define the articleId with the "id" attribute of the "<article>"container.
Reply all
Reply to author
Forward
0 new messages