Force update inline comments without reloading a page (Javascript)

Hello,
Is there any way to make confluence update its inline comments from server without page reload.
(for example, to get comments updates which are done in another browser’s tab).
I need some js API or hack.
Thanks.

Hi @NovelCompan,

Unfortunately, I don’t think there’s an easy way. (happy to be proven wrong, though)

I’m pretty sure the position of inline comments are stored inside the page content (Storage Format), right? So, there being a new inline comment is really just a page edit (i.e. other new content could’ve appeared, too). You’d essentially have to find a way to dynamically re-render the whole page content if you wanted to be 100% safe. Not sure if you want to dig into that.

From a technical perspective, you could probably also look at Confluence’s source code and figure out what JS they use to render inline comments. Let’s say you find something like Confluence.initInlineComment() in the source code, and have an easy way to do it. Then you could have a script that listens for new page versions / inline comments while a user is viewing a page. If there is a new inline comment, your script then gets the new page content, parses it for the position and properties of the inline comment, and displays it using the function you found. However, this is also not very nice because it’s quite hacky and also has the potential to cause performance issues depending on how you implement it.

Nevertheless, hope this helps!

Cheers,
Sven