Page crashes when you add custom script inside quix page

Page crashes when you add custom script inside quix page The problem is when you add some script, it replaces the entire body or breaking the entire builder or page.

JavaScript Document.Write Replaces All Body Content

Issue:

You cannot use document.write once the document has completed loading. If you do, the browser will open a new document which will replace the current one.

Solutions:

Use the innerHTML property to put HTML code inside an element:

function gen_output(ad_content){
  document.getElementById('element-id').innerHTML = ad_content;
}

Put the element before the script, so that you are sure that it exists when the callback function is called:

i am text before
<div id="element-id"></div>
i am text after

<script type="text/javascript" src="/mb.js"></script>

It doesn't matter much where you place the script, as nothing will be written to the document where it is.

For more details, please check this link: stackoverflow

Joomla SEO Service

Grow rapidly with our Joomla SEO service done by the veterans

With over 12 years of business and a vast array of Joomla templates and extensions, we know Joomla SEO better than anyone you could possiblly hire.

Improve my ranking
On This Page