Uncaught TypeError: Cannot read property 'hideFooter' of undefined

all.js and all-debug.js both script gives error:
Uncaught TypeError: Cannot read property ‘hideFooter’ of undefined

I tried to debug all-debug.js and it seems the combined.env is undefined.

image

and this causing the error.

Here’s my code:

<script src="https://connect-cdn.atl-paas.net/all-debug.js" type="text/javascript"></script>
<title>Test</title>
<script>
$(document).ready(function () {
    $.ajax({
        type: 'GET',
        url: '@Url.Action("LoadData", "Home")',
        //data: '',
        success: function (data) {
            $('#helpFrame').prop('srcdoc', data);
        }
    });
})
</script>

Hello World

Addon content goes here

	<iframe id="helpFrame" style="height: 100%; width: 100%;"></iframe>
</div>

Can you help me with this?

Can you provide a sample how to load an API result using javascript?

Cheers,
AL

Not sure what’s cominded.env ?
To load data you would need to call your API and in call back need to populate the data using dom manipulation. For example see how it’s done using axios simple example

axios.get("url").then((response) => {
  let data = response.data;
  for (let i = 0; i < data.length; i++) {
    $("#data-div").append(
      `<tr>
          <td>
              <div class="name"><span>${data[i].name}</span> :  
              <span class="date" style="float:right">${data[i].created_date}</span></div>
          </td>
      </tr>`
    );
  }
});

Thanks for the response. The combined.env is inside all.js and all-debug.js not sure why its undefined thou.

I am using .NET MVC and JQuery. I am getting a HTML result from API which I am trying to load inside the iframe. I tried to download the all.js from my end and tried to remove the error by adding some checking script Something like this:

  if (combined.env) {
      combined.env.hideFooter(consumerOptions.get('hideFooter') === true);
  }

and that do the trick for now. I am planning to retrieve all.js from connect-cdn later.

Now Im getting another error:

we dont have a “cgraphq” controller somewhere in my code. Do I need to install anything to get a wiki from Confluence? This is how I’m consuming the API:

using (var request = new HttpRequestMessage(new HttpMethod(“GET”), “https://test.atlassian.net/wiki/test/testURL”))
{
try
{
var base64authorization = Convert.ToBase64String(Encoding.ASCII.GetBytes(“username:token”));
request.Headers.TryAddWithoutValidation(“Authorization”, $“Basic {base64authorization}”);
var response = await httpClient.SendAsync(request);
//response = httpClient.SendAsync(request);
//uri = response.RequestMessage.RequestUri; //.Headers.Location;

                    if (response.IsSuccessStatusCode)
                    {
                        using (HttpContent content = response.Content)
                        {
                            System.Threading.Tasks.Task<string> s = content.ReadAsStringAsync();
                            result = s.Result;
                            //result = "<html><body><div>HELLO WORLD</div></body></html>";

                            ViewBag.HelpContent = HttpUtility.HtmlEncode(result);
                        }
                    }


                }
                catch (Exception e)
                {

                }
            }
        }

What I’m trying to achieve is to load a wiki from Confluence (with video) to my web application using jQuery and .NET MVC

I think this is being loaded internally by confluence, it would be tricky to do what you are trying as all relative resources will fail to load. IMHO better approach would be look at Confluence REST APIs and use them instead try to load the page directly in iframe.

I actually tried the samples and guides from Confluence Server REST API and I’m getting a HTML result. Tested it using postman and I got same result. Now I’m in dead end when I’m trying to load the HTML result in iframe. There are no .NET sample from Confluence documentation, that’s why I’m trying to find a work around to make it work using .NET and JQuery. Things are getting complicated. Been trying to figure it out for a week now.

REST API solution to get content is given on this thread https://community.atlassian.com/t5/Confluence-questions/how-to-get-full-content-body-html-using-confluence-REST-API/qaq-p/710532#M99548

Don’t see a reason why it won’t work, this would return a JSON and you can take the content out and display

Thanks I’ll check on the link.