1
votes

A school website doesn't let me copy text or select it.

Other websites work fine, but that website doesn't work.

Is there a way to bypass that and copy the text?

enter image description here

The website is https://www.chimica-online.it/download/sistema-internazionale-unita-misura.htm

What I really want

Something like this:

enter image description here


What I tried

I tried to use this CSS:

* {
  user-select: auto !important;
}

When creating navbars I sometimes use this CSS property for not allowing text selection: user-select: none;
But in their case I think they are using it on the entire website. This is why I tried to use * CSS selector, but is not working.

2
They may have some clever JavaScript which gets in the way of this functionality by directly modifying text selection or redirecting click or drag events. Getting around it may take more work. Press F12 to see your browser's debugging tools. You can disable JavaScript, directly access the page source or current DOM, etc. Essentially this is a game of walls and ladders regarding how much effort they put in to protect the data and how much effort you put in to copy it. - David

2 Answers

3
votes

just open devtools, and write document.onselectstart = ""

enter image description here

how I find it?

I opened dev tools, and I tried your code, and actually is not work,

so I think that they didn't use the CSS trick,

so I tried to see if they have some scripts.

the script that seems interesting is this one:

enter image description here

now what what is there: enter image description here

they write cleverly this code onstartselect = return false (so it not your browser bug, but they want to do it)

that it, I used devtools and I overridde it. setting it to "" empty string

the solution is write document.onselectstart = ""

2
votes

The problem doesn't reside in CSS. Opening the dev tools, and navigating to the JS in the sources section, shows that there is this function:

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

This basically makes the text unselectable, no matter what CSS attributes you fiddle with. You'll need to overwrite this JS functionality.

The culprit exists on line 25 of a prettier formatted version of the general_4.js file.

You can overwrite it by pasting this into the dev tools console:

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

Or use a custom injection of your choice.