Search code examples
htmlsafarimobile-safari

Stop safari from sharing canonical url


I recently noticed that the safari share sheet sends the canonical url when a user uses it to share a webpage.

Is there a way to overwrite that behaviour via html or some other way?

It really screws a lot of things up...


Solution

  • What I ended up doing is simply removing the canonical link with a timer after the document is ready with the following simple code:

    setTimeout(function(){
        document.querySelector("link[rel='canonical']").remove(); 
    },500);