Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,337
Community Members
 
Community Events
165
Community Groups

HTML problem in display

So I am using the HTML Macro at the bottom of my page and inserting the following code into the created HTML box. When I preview the page it looks great, but when I save it, all I see is the time stamp. My page content disappears Clearly I am doing something wrong but can anyone help me out? 

 
<!DOCTYPE html>
<html>
<body>

<h1>Time of Last Edit</h1>
<h2></h2>

<p>This document was last modified:</p>
<p id="demo"></p>

<script>
let text = document.lastModified;
document.getElementById("demo").innerHTML = text;
</script>

</body>
</html>

1 answer

1 accepted

0 votes
Answer accepted
Dominic Lagger Community Leader Jun 02, 2022

Hi @Colm Maguire 

What do you want to achieve? 

Because, "document.lastModified" will not get you the last modification date of the page. It will get you the last modification date of the "HTML document type", not the document from confluence. You can use this javascript in any other page or even in the console of your browser. 

If you want to get the date of the latest modification of the confluence page, then you need to write a user macro:

Regards, Dominic

Oh dear me. Okay thank you for that. I guess I am gonna have to learn :D 

Like Dominic Lagger likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

733 views 5 21
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you