• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 HTML anchors in post

#1
Hi, I want to create simple html anchors inside posts. How can I do that? In vBulletin there was a simple bb-code based plugin.

Like
<a href="#anchor">Link Text</a>
<a name="anchor"></a>
 

Brogan

XenForo moderator
Staff member
#2
It's not as simple as creating a bb code in XF due to the base href.

It requires some backend PHP code to make it work.
 

cclaerhout

Well-known member
#4
hmm, I only need one anchor. So I actually managed to insert <a name="#anchor1"></a> into a post with custom bb code. But it only works in IE, not chrome and firefox, jump to with https://example.com/community/threads/html-anchors-in-post.97329/#anchor1. Do I still need php-code to make it work?
This addon has an anchor Bb Code (works in every editor; Tinymce is not needed unless you want the Wysiwyg interface). To see how it works, check the screenshots of this update.
 
#5
Thanks for the suggestion cclaerhout.

Found another way. If you only need a couple of anchor, add this as custom bb code:
<a href="javascript:;" onclick="document.location.hash='anchor1';">custom test</a>

And in another bb-code
<a name="anchor1"></a>