Reputation: 1
I want to add a canonical tag in my next js application but I'm stuck on this error,
67791:1 Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened. (anonymous)@67791:1
I have tried various approaches.
1. <Script
src="//tags.orquideassp.com/--"
strategy="--"
/>
2. useEffect(() => {
const script = document.createElement('script');
script.src = "//tags.orquideassp.com/---";
script.async = false;
script.defer = false;
document.head.appendChild(script);
return () => {
document.head.removeChild(script);
};
}, []);
3. <Head>
</Head>
<script src="//tags.orquideassp.com/--" />
Upvotes: 0
Views: 61