-
Star
(153)
You must be signed in to star a gist -
Fork
(25)
You must be signed in to fork a gist
/* | |
<https://stackoverflow.com/questions/40296831/is-it-possible-to-force-a-copy-of-a-protected-google-doc> | |
NOTE - 2021-05-24 | |
----------------- | |
The script below isn't the fastest way to copy-and-paste from a protected | |
Google Doc. Before trying it, I'd suggest following MikoFrosty's advice from | |
the comments: | |
1) Change the end of the document url from `/edit` to `/mobilebasic`. | |
2) Disable Javascript (as described in steps 2 and 3 below). | |
3) Keeping the console open, reload the page. | |
That should be enough to allow you to copy freely. The script here is | |
*probably* only necessary if the /mobilebasic view isn't rendering something | |
correctly. | |
HOW TO USE | |
---------- | |
1) Open the protected Doc using Chrome. Scroll all the way down to the bottom | |
to make sure that it is entirely loaded. | |
2) Open Chrome Developer Tools (<Ctrl+Shift+I>), and click "Console" to open | |
the Javascript Console. | |
3) Open the Command Console (<Ctrl+Shift+P>). Type "javascript", and select | |
the option "Disable Javascript" when it appears. | |
4) Copy the script below into the Javascript console. | |
5) Leaving the Javascript Console open, you may now copy-and-paste from the | |
document as normal. (Some formatting may be broken. Closing the console may | |
re-lock copy-and-pasting.) | |
6) (OPTIONAL) To copy the entire document as plain text (no formatting), type | |
the following into the console: | |
document.body.innerText | |
The text will be loaded into the Console itself; copy it by clicking the | |
gray-highlighted "COPY" at the end. | |
*/ | |
function rtcScript() { | |
document.oncontextmenu = null; | |
document.onselectstart = null; | |
document.onmousedown = null; | |
document.onclick = null; | |
document.oncopy = null; | |
document.oncut = null; | |
var elements = document.getElementsByTagName('*'); | |
for (var i = 0; i < elements.length; i++) { | |
elements[i].oncontextmenu = null; | |
elements[i].onselectstart = null; | |
elements[i].onmousedown = null; | |
elements[i].oncopy = null; | |
elements[i].oncut = null; | |
} | |
function preventShareThis() { | |
document.getSelection = window.getSelection = function() { | |
return {isCollapsed: true}; | |
} | |
} | |
var scripts = document.getElementsByTagName('script'); | |
for (var i = 0; i < scripts.length; i++) { | |
if (scripts[i].src.indexOf('w.sharethis.com') > -1) { | |
preventShareThis(); | |
} | |
} | |
if (typeof Tynt != 'undefined') { | |
Tynt = null; | |
} | |
} | |
rtcScript(); | |
setInterval(rtcScript, 2000); |
Any updates? None of the afforementioned steps work for now.
The mobilebasic method still works for me
(copied from @mitar)
- Change the end of the document url from /edit to /mobilebasic.
- Disable Javascript (as described in steps 2 and 3 below).
- Keeping the console open, reload the page. Select all + copy.
- Create a new blank Google Doc. Paste.
What part of this process is not working for you?
hi, does anyone know how to copy it not on mobile view? the doc i want to copy a table that appears differently on mobile and desktop (i cannot figure it out on my own :P)
does that still works on google spreadsheet , when i do this it gives a random number
this still works. i tried it on this → https://docs.google.com/document/d/13uWn9iUqYLbpGDyaT8r3kReGMA0WyiNrcA_QPX2DfN0/mobilebasic
Works perfectly fine. Script not needed. Just change URL and disable JS ;)
@onurogut I get a page that only shows the file name as a title and File/Edit/View/Tools/Help/... as subtitles 🤔
sure here source code to download
https://github.com/VHAE04/copy-protected-doc
demo https://www.youtube.com/watch?v=fMW65aVWOmg
@senhalil I tried with example that @deadcoder0904 shared and I'm attached a screenshot:
command+shift+r to switch reading mode:
As you can see, I can select all text/images by just simply command+a, copy and paste it into notes:
I would update the instructions to:
- Change the end of the document url from
/edit
to/mobilebasic
.- Disable Javascript (as described in steps 2 and 3 below).
- Keeping the console open, reload the page. Select all + copy.
- Create a new blank Google Doc. Paste.
That retained all formatting for me perfectly.
It works!!
IT WORKED
- Change the end of the document url from
/edit
to/mobilebasic
.
when I add "mobilebasic" end of url for google sheet it says
"Sorry, unable to open the file at present.Please check the address and try again."
- Change the end of the document url from
/edit
to/mobilebasic
.when I add "mobilebasic" end of url for google sheet it says "Sorry, unable to open the file at present.Please check the address and try again."
same
it works!
I found a workaround in /mobilebasic
without having to disable JavaScript. You just have to rename the docsshared-no-select
class to anything else and the script that prevents you from copying stops working.
I found a workaround in
/mobilebasic
without having to disable JavaScript. You just have to rename thedocsshared-no-select
class to anything else and the script that prevents you from copying stops working.
👍
it's not working for me
I found a workaround in
/mobilebasic
without having to disable JavaScript. You just have to rename thedocsshared-no-select
class to anything else and the script that prevents you from copying stops working.
yeah buddy!
Any updates? None of the afforementioned steps work for now.
The mobilebasic method still works for me (copied from @mitar)
- Change the end of the document url from /edit to /mobilebasic.
- Disable Javascript (as described in steps 2 and 3 below).
- Keeping the console open, reload the page. Select all + copy.
- Create a new blank Google Doc. Paste.
What part of this process is not working for you?
Yea that works for me, so whats the point of this script if you could just do that?
once changing /edit to /mobilebasic it is shown as not found
Does anyone have a working method for this at the moment?
In Brave, changing the url from /edit to /mobilebasic, then disabling javascript seems to of been patched for trying to copy text from a protected Google Doc.
@narutohokague777 @grxvy @blacklabelbob @010DevX101
have created a bookmarklet
https://gist.github.com/ankitpandey2708/1c14e8e923fd02d7f2f721e309f5cd69
This worked like a charm! 😃