How to render the content of a Confluence page including the Confluence page CSS and Javascript ?

Hello,

Im trying to get the contents of the Confluence page to another site using the JSON-RPC renderContent method. The below code return me most of the contents but some javascript functions are missing and CSS so some Confluence plugins are not working (Expand macro,Info macro).

Do you know how to fix this? Or is there another method to load the Confluence javascript and CSS ?

Also we did notice a character "�" getting displayed when the html code has an empty paragraph

' <p> </p>' . Do you also know why this occurs ?

Is this an encoding issue ? I checked my Confluence configuration and the Encoding s set to UTF-8.

Below is the code to call "renderContent" method

$.ajax({
			type: "POST",
			url: "http://samplehost.net/confluence/rpc/json-rpc/confluenceservice-v2/renderContent",
			data: ' [ "AIPAS", 32538632, "" ] ',
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			success: function(data){
				$("#mydiv").html(data);
			},
			failure: function(errMsg){
				alert(errMsg);
			}
		});

2 answers

This widget could not be displayed.

I have the same problem. I can not solve it.

This widget could not be displayed.

I think you might be better off just doing a regular fetch of the page -- use the actual page URL:

jQuery.ajax({
    url : "/display/${space}/${mypage}?decorator=printable",
    success : function(result){
        do something with the result;
    }
  });

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

110 views 15 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you