I have a macro on my page which executes AJS.$("#page").css("display", "none");
to hide the main page and inserting other content. Somehow hiding the
confluence page causing the site to crash. In firefox I get the message that a webpage is slowing down the browser. A confluence script hangs-up after executing this line and I can not figure it out where exactly.
I tried it without jquery and with plain javascript only. Its even happening if I inspect the page element and change the css via the Firefox Inspector.
This is really frustrating because I can not find any clue what is going on there.
Can you explain why you want to do this?
It feels weird to me that you want to hide the entire page, and I’m guessing that will cause a lot of problems.
Wouldn’t it be easier to embed your content in the page?
Bonus question: are you building for Confluence Server or Cloud? Moving this to the right category might help you find answers quicker.
my intention is to hide the entire page and insert a iframe with my custom content which is referencing to a specific destination in the confluence context. Regardless this is working fine somehow.
After I stop the hanging script, I can not identify which script it is, the page is getting hidden and my iframe is shown with my content. But before some internal confluence script freezes while trying to hide the “#page”.
Somewhere it is mentioned that the RTE Editor for Confluence is build on the same scheme.
Hide the page and open the RTE by make it visible.
Update
Why don’t you redirect all (or which ever you want) incoming links to an action of yours that renders only that iframe? You can use atl.main (i think) as a decorator which won’t render the majority of things confluence comes with
Yes I’m using AJS.toInit. I even used a timeout to see if my script or making the page invisible is freezing. Its clearly a internal script which runs concurrent and freezes.
But I finally found a workaround which seems to be working fine without triggering
the internal freeze bug! Instead of making the #page invisible it is possible to modify the style of the body to
AJS.$(“body”).css(“overflow”, “hidden”);
This removes the scrolling effect for the whole body. Now you attach the iframe to the body and set it position to “Fixed” and choose a high value for the zIndex to set it to the top.
This apporach has the same visual effect like hiding #page.
I hope this is comprehensible.
As far as i am concerned if it is working, it ain’t stupid
Did you check though your loading times?
You are loading all what page loads (js, confluence, header, menu, mobile, css, blah blah) and on top of that your iframe loads.