Make getPageData() and getSiteData() SSR-compatible
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3590553. -->
Reported by: [effulgentsia](https://www.drupal.org/user/78040)
Related to !1113
>>>
<h3 id="overview">Overview</h3>
<p><code>window</code> only exists in browsers.</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<ul>
<li>For accessing global variables, replace <code>window.</code> with <code>globalThis.</code>.</li>
<li>Call <code>postMessage()</code> only when <code>window</code> exists. It's only used for the in-browser code editor so doesn't need to happen in non-browser environments.</li>
</ul>
<h3 id="ui-changes">User interface changes</h3>
issue