{"result":{"depiction_url":null,"edges":{"in_module":{"objects":[{"created":"2020-05-30T05:47:18Z","object_id":{"id":1303,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_wires","title":"mod_wires","uri":"https:\/\/zotonic.com\/id\/1303"},"seq":1000000}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"references":{"objects":[{"created":"2020-05-30T05:47:18Z","object_id":{"id":1302,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_server_browser_interaction","title":{"_type":"trans","tr":{"en":"Handle a browser event with a wire"}},"uri":"https:\/\/zotonic.com\/id\/1302"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"subject":{"objects":[{"created":"2026-09-09T13:48:07Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:48:07Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-09-09T13:48:07Z","object_id":{"id":2623,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_scomp","title":"Server component","uri":"https:\/\/zotonic.com\/id\/2623"},"seq":3},{"created":"2026-09-09T13:48:07Z","object_id":{"id":2641,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_render","title":"Render","uri":"https:\/\/zotonic.com\/id\/2641"},"seq":4},{"created":"2026-09-09T13:48:07Z","object_id":{"id":2673,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_javascript","title":"JavaScript","uri":"https:\/\/zotonic.com\/id\/2673"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1301,"is_a":["text","documentation","reference","template_scomp"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1301"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_template_scomp_scomp_script","page_url":{"en":"https:\/\/zotonic.com\/docs\/1301\/script","x-default":"https:\/\/zotonic.com\/docs\/1301\/script"},"preview_url":null,"resource":{"version":4035,"pivot_location_lat":null,"title":"script","is_authoritative":true,"body":"<p>This tag is the placeholder where all generated JavaScript scripts will be output on the page.<\/p>\n<p>Zotonic generates JavaScript for the actions and other template logic. This script needs to be added to the page. The\n<code>{% script %}<\/code> scomp designates the place where the <code>&lt;script&gt;<\/code> element with all the generated javascript can be placed.<\/p>\n<p>Normally the <code>{% script %}<\/code> scomp is placed at the end of the page, just above the <code>&lt;\/body&gt;<\/code>.<\/p>\n<p>Note that all JavaScripts generated after the <code>{% script %}<\/code> scomp will not be included in the generated page. Only a\nsingle <code>{% script %}<\/code> scomp is allowed on any page.<\/p>\n<p>Example:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">    {# at the bottom of the template ... #}\n    {% script %}\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>This will generate something similar to:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">&lt;script type=&#39;text\/javascript&#39;&gt;\n$(function() {\nz_pageid=&quot;MouKz4PgrcROM5efU8iL&quot;;\nz_postback_loop();\n\n$(&#39;#vtretq&#39;).bind(&#39;click&#39;, function(event) { window.location = &quot;\/admin\/edit\/647&quot;; return z_opt_cancel(this); } );\nz_init_postback_forms();\nz_default_form_postback = &quot;bVcYISt9JOG\/AQZkP9SOZmc\/\/GqDaAVrAAZzdWJtaXRkAAl1bmRlZmluZWRkAAl1bmRlZmluZWRqZAANcmVzb3VyY2VfcGFnZQ==&quot;;\n});\n&lt;\/script&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>Note that the contents of this block will be completely different per page.<\/p>\n<p>The script scomp can have the following arguments:<\/p>\n<table class=\"table\"><thead><tr><th>Argument<\/th><th>Description<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td><code>nostartup<\/code><\/td><td>Exclude the page initialization code from the script, only includes the scripts from actions etc. Default is to include the page initialization code.<\/td><td><code>nostartup<\/code><\/td><\/tr><tr><td><code>nostream<\/code><\/td><td>Do not start the bi-directional communication layer (over WebSockets or comet).<\/td><td><code>nostream<\/code><\/td><\/tr><tr><td><code>format<\/code><\/td><td>Select a different format than the <code>&lt;script&gt;<\/code> tag. For now this accepts <code>&quot;html&quot;<\/code> (for the <code>&lt;script\/&gt;<\/code> tag), <code>&quot;escapejs&quot;<\/code> for an escaped javascript string, and <code>&quot;js&quot;<\/code> for a normal javascript string. Default is <code>&quot;html&quot;<\/code>.<\/td><td><code>format=&quot;html&quot;<\/code><\/td><\/tr><\/tbody><\/table>\n<h2>WebSockets \/ Comet communication<\/h2>\n<p>Unless <code>nostream<\/code> is added as a parameter, this tag also causes the WebSockets or Comet communication layer to be initiated.<\/p>\n<p>When available, a WebSocket connections is opened, otherwise a long polling Comet connection is started. The WebSockets\nconnection will also be used for sending Ajax requests to the server.<\/p>\n<p>See also <a href=\"\/id\/doc_developerguide_server_browser_interaction#guide-transport\">Transport<\/a> for details on the\nbi-directional communication.<\/p>","slug":"script","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"8d7db2bdfa749699a7fe12afa7d441aa3f37e2d6863c53c13208fe20f6f3aff6","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":327,"is_a":["meta","category"],"name":"template_scomp","title":"Scomp","uri":"https:\/\/zotonic.com\/id\/template_scomp"},"doc_source_path":"apps\/zotonic_mod_wires\/src\/scomps\/scomp_wires_script.erl","publication_start":"2023-06-24T08:18:02Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_wires\/src\/scomps\/scomp_wires_script.erl","pivot_location_lng":null,"doc_source_kind":"scomp","name":"doc_template_scomp_scomp_script","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-05-30T05:47:17Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_wires","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"28493fb676b2d92727e68d4fba20d89c56cf8ead\n","erlang_module":"scomp_wires_script","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-10-15T20:07:34Z","title_slug":"script"},"uri":"https:\/\/zotonic.com\/id\/1301","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1301"}},"status":"ok"}