unescaped javascript string
-
While using developer tools on a web page, I noticed the following javascript…
Uncaught SyntaxError: "" string literal contains an unescaped line break
This error was being caused by the line starting with text: ” in the following script generated by your plugin…
<script> window.addEventListener("DOMContentLoaded", function(){ if ( navigator.share ) { let shareurl = document.location.href; let btns = document.querySelectorAll(".juiz_sps_link_shareapi button:not([data-bound])"); const canon = document.querySelector("link[rel=canonical]"); if (canon !== null) { shareurl = canon.href; } btns.forEach(function(el) { el.closest(".juiz_sps_link_shareapi").removeAttribute( "style" ); el.setAttribute( "data-bound", "true" ); el.addEventListener("click", async () => { try { await navigator.share({ title: "How To Protect WordPress with CloudFlare Firewall Rules", text: "How To Protect WordPress with CloudFlare Firewall Rules - OVERVIEW CloudFlare recently added Firewall Rules to all accounts, including", url: shareurl, }); console.info("Successful share"); } catch(err) { console.warn("Error sharing", error); } }); }); } }); </script>
It looks like you could use some esc_js() calls on your javascript string outputs.
Thanks.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘unescaped javascript string’ is closed to new replies.