@sebgroup/document-write-intervene
v3.0.0
Published
Prevent document write from writing to your document and instead insert a new script to the dom.
Downloads
4
Readme
document-write-intervene
Overwrites document.write
function and will prevent it from clearing your document contents due to how document.write
works when the document has been loaded.
It checks if the markup is a <script>
tag and will load it asynchronous.
Otherwise it will insert the contents using insertAdjacentHTML
on the body
Tested inside an Angular project.
It should work seamlessly with a React project.
Otherwise you could have a look at browserify
to integrate it in your project
Installation
Install via npm:
$ npm install @sebgroup/document-write-intervene
Example
const { intervene } = require('@sebgroup/document-write-intervene')
intervene()
Testing
Unit tests:
$ npm t
E2E tests:
- Chrome tests:
$ npm run webdriver:chrome
and then
$ npm run e2e:chrome
- Internet Explorer tests:
$ npm run webdriver:ie
and then
$ npm run e2e:ie