Open davidjb opened 7 years ago
Reported at https://squizmap.squiz.net/matrix/10584. This breaks our preview windows until we can find a workaround. Grrr.
Workaround:
<script runat="server" id="underscore.js">
%globals_asset_file_contents:12345%
</script>
Solved for now.
A direct bodycopy div rendering via https://www.example.com/site/_nocache?a=12345 (where the Preview -> In New Window sends you) or via ?SQ_ASSET_CONTENTS=12345 evaluates SSJS but has issues when attempting to include SSJS via src. This example is just printing:
and the browser receives output of:
so the server script tag goes to the client instead of being processed, and the following
print
statement doesn't (appear) to succeed.If I change the example to
I end up with the following output:
so the SSJS runs before it hits the src tag but not after. Finally, the result that makes me think this is related to the SSJS concatenation issue from earlier. This is the code:
which produces:
So you end up with messed up output -- the later h1 print ends up too early and the server script block still gets sent to the client.
Content of the src included SSJS file doesn't appear to matter; pointing the src at an empty file yields the same result as having something in it.