Jump to content

Embed-block: How do I disable text selection?

Recommended Posts

Posted

My site uses v7.0. I was successful in blocking text selection for the whole site by injecting this code to "Code Injection":

Quote

<script>
  function disableselect(e) {
    return false;
  }

  function reEnable() {
    return true;
  }

  document.onselectstart = new Function("return false");

  if (window.sidebar) {
    document.onmousedown = disableselect;
    document.onclick = reEnable;
  }
</script>

However, this did not work for the embedded Google Docs document and I was able to select the text inside both the code block and the embed block.

I've also tried finding a solution from the Google Docs side, but there doesn't seem to be a way to stop this.

Any suggestions?

  • Replies 2
  • Views 1.4k
  • Created
  • Last Reply
Posted

Hi Rasmus, thanks for your answer. I tried it, but it didn't have the wanted effect. user-select is active, but I can still select the text inside the embedded code block.

262196789_DevTools-CSSclassdisable-select.thumb.png.a8a0075c519294cd185ec851d7cfdeb7.png

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.