The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting if page is included in another page

jonb
January 21, 2020

I have a macro ("Macro A") on one page that is running some javascript and creating some html.

 

That page is then included using the "Page Include" macro.

 

Is there a way, inside Macro A, to determine that it is inside the Page Include macro?

And then alter (in this case, disable some of the javascript and html) what Macro A is generating?

 

Currently, i'm using the AJS.toInit and searching for the "include" tag in the parent html.  This doesn't work as nicely as detecting it ahead of time, because i have to retroactively disable javascript or "display:none" html.


<script type="text/javascript">
var $pageIncluded = false;

AJS.toInit(function(){
a = document.getElementById("macro-a-content");
b = a.closest("[data-macro-name='include']")
if(b){
$pageIncluded = true;
}

)}
</script>

 

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events