Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events