ItsaMeTuni
ItsaMeTuni

Reputation: 475

Trigger click on Save To Drive button

I'm trying to use the Save to Drive button from Google Drive's API but with a custom look. My objective is to hide the button and trigger its click event so the save window pops up. However, I cannot find a way to trigger the click event on the button. I have tried calling click() and dispatchEvent() on the button's div without success. It appears as that the script uses addEventListener since nothing is assigned to either onclick, onmouseup or onmousedown on the button's div.

Using DOM event breakpoints in chrome dev tools I can see what code is called when I click the button (and it seems that the script uses the 'mouseup' event) but I cannot understand what's going on since the code is minified (and maybe obfuscated? I can't tell).

I know this has been asked before here, but the answer, instead of triggering the click on the button, uses the Google Drive API, which I want to avoid because I do not want to go through all Google's verification process to be able to access the drive scope.

Has anyone managed to do this before? Any ideas on what I can try?

Thanks a lot for the help!

Upvotes: 1

Views: 187

Answers (1)

ItsaMeTuni
ItsaMeTuni

Reputation: 475

I discovered it is impossible to do this. Since the button is in an iframe element, the browser prevents Javascript from accessing it.

Upvotes: 1

Related Questions