Skip to content

Commit

Permalink
update iframe url on website change
Browse files Browse the repository at this point in the history
SQUASHED: AUTO-COMMIT-src-components-widgets-lively-iframe.js,
  • Loading branch information
onsetsu committed Aug 21, 2024
1 parent 2445453 commit cd955e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/widgets/lively-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ export default class LivelyIFrame extends Morph {
this.windowTitle = "iFrame Browser";
this.input.onchange = () => this.update();
lively.html.registerButtons(this)
this.renewIFrameListener()

if (this.getAttribute("src")) {
this.setURL(this.getAttribute("src"));
}
}

renewIFrameListener() {
lively.removeEventListener('iframe', this.frame, 'load')
lively.addEventListener('iframe', this.frame, 'load', e => {
lively.warn('now2', this.input.value = this.frame.contentWindow.location.href)
})
}

update() {
const url = this.input.value;
this.updatePersistence(url);
Expand Down

0 comments on commit cd955e0

Please sign in to comment.