Skip to content

Commit

Permalink
fix snapshot_live iframe scrollTo not working due to origin sandbox r…
Browse files Browse the repository at this point in the history
…ules
  • Loading branch information
pirate committed Jun 3, 2024
1 parent 11a24d9 commit 729f05a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions archivebox/templates/core/snapshot_live.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,14 @@ <h4>Headers, JSON, etc.</h4>
this.src = this.src + '#toolbar=0'
}
this.onload = function() {
this.contentWindow.scrollTo(0, 0);
// this.src = this.src
if (this.src.endsWith('.pdf')) {
this.removeAttribute('sandbox')
this.src = this.src + '#toolbar=0'
}
try {
// doesnt work if frame origin rules prevent accessing its DOM via JS
this.contentWindow.scrollTo(0, 0);
} catch(err) {}
}
})

Expand Down

0 comments on commit 729f05a

Please sign in to comment.