FOllowing the video and sample code from https://developers.google.com/drive/web/quickstart/quickstart-js to upload any file from local system to google drve i was stuck with an error which states
"Refused to display 'https://accounts.google.com/o/oauth2/auth?client_id=%3CAIzaSyDa2kGIMQCLdfzk…%2Flocalhost&response_type=token&state=513052220%7C0.1330524626&authuser=0' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'."
I registered for a new client ID and also changes in the code with new clien ID Also disabled the chrome security using "chrome.exe --user-data-dir="c:/temp/chromedev" --disable-web-security" in run command.
I faced the below issue while loading the PDF document into iframe from google drive.
Problem: Refused to display 'https://drive.google.com/file/d/1ipnylkWoSx4NS0GtmsQVFUq7ms339DAW/view' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Reason: As per my analysis, I faced this issue due to the URL is not considering as embedded to allow loading from other websites.
Solution: I did even tried with the solution of adding ?embedded=true to the URL but still no luck. Then I got one solution from https://support.google.com/drive/thread/34363118?hl=en and replaced the view with preview in my URL and problem solved.
https://drive.google.com/file/d/1ipnylkWoSx4NS0GtmsQVFUq7ms339DAW/preview
2.1m questions
2.1m answers
60 comments
57.0k users