Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My solution is similar to the one of <a href="https://stackoverflow.com/users/1001224/lolo">lolo</a> above. However, I insert the HTML code via JavaScript's document.write instead of using jQuery:</p> <p><strong>a.html:</strong></p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;h1&gt;Put your HTML content before insertion of b.js.&lt;/h1&gt; ... &lt;script src="b.js"&gt;&lt;/script&gt; ... &lt;p&gt;And whatever content you want afterwards.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>b.js:</strong></p> <pre><code>document.write('\ \ &lt;h1&gt;Add your HTML code here&lt;/h1&gt;\ \ &lt;p&gt;Notice however, that you have to escape LF's with a '\', just like\ demonstrated in this code listing.\ &lt;/p&gt;\ \ '); </code></pre> <p>The reason for me against using jQuery is that jQuery.js is ~90kb in size, and I want to keep the amount of data to load as small as possible.</p> <p>In order to get the properly escaped JavaScript file without much work, you can use the following sed command:</p> <pre><code>sed 's/\\/\\\\/g;s/^.*$/&amp;\\/g;s/'\''/\\'\''/g' b.html &gt; escapedB.html </code></pre> <p>Or just use the following handy bash script published as a Gist on Github, that automates all necessary work, converting <code>b.html</code> to <code>b.js</code>: <a href="https://gist.github.com/Tafkadasoh/334881e18cbb7fc2a5c033bfa03f6ee6" rel="noreferrer">https://gist.github.com/Tafkadasoh/334881e18cbb7fc2a5c033bfa03f6ee6</a></p> <p>Credits to <a href="https://stackoverflow.com/users/1527747/greg-minshall">Greg Minshall</a> for the improved sed command that also escapes back slashes and single quotes, which my original sed command did not consider.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload