iframe-injectable documentation
Simple typescript function allowing one to inject into iframe any javascript, styles, css that is desired.
Example of use
; ;successDiv.setAttribute'name', 'success';successDiv.appendChilddocument.createTextNode'Success!'; ;successSpan.appendChilddocument.createTextNode'Span success'; // Load iframe .domsuccessDiv // Add div to body .domsuccessSpan, '[name="success"]' // Add span to element named success .style'body { background-color: pink; }' // Add styles to within iframe .css'style.css' // Add css link with this rel .js;
Addendum
This package may throw CORS errors if you try and edit an iframe which is from cross-domain without proper policy.
Changes since 0.1.0
Can now test CORS accessibility with .test() method, which returns a boolean promise
Footer
If you discover any bugs, or have ideas about improving this package, do not hesitate to file in an issue or create a pull request.