As the title says I cant reach the scrollTop element of <body>
inside my <embed>
'ed html file.
Im trying to implement a scrollTop button on my index page which loads html documents via js.
content.innerHTML = "<embed id='object' onscroll='scrollFunction()' width='100%' height='100%' src='" + documentName + "'></embed>'";
I tried things like document.getElementById("object").body.scrollTop = 0;
The result is obviously an exception in the console or constantly scrollTop = 0
if I let the .body out and log document.getElementById("object").scrollTop
(before setting it to 0)
EDIT:
I changed <embed src=></embed>
to <object data=></object>
and
var object = document.getElementById("object");
var htmlDocument = object.contentDocument;
htmlDocument.body.scrollTop = 0;
The console exception is:
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLObjectElement': Blocked a frame with origin "null" from accessing a cross-origin frame.
Idk whats goin on