Skip to content

Commit

Permalink
devkit: fix iframe not refreshing when loading the same URL
Browse files Browse the repository at this point in the history
  • Loading branch information
abarisain committed Feb 18, 2021
1 parent 6bc3d0c commit 56a8bd2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ The devkit will also implement `batchInAppSDK` with test values.
Open index.html in a browser.
Set the URL to the server serving your in-development template web page, and click `Load`.

When performing actions on `batchInAppSDK`, they will be logged on the right.

Note: Due to how iframes work in a browser, you might need to reload the page when you update the page you're working on or it will not refresh.
You can use `Remeber URL` to save the URL you're currently displaying: it will automatically be restored on reload.
When performing actions on `batchInAppSDK`, they will be logged on the right.
2 changes: 2 additions & 0 deletions devkit/devkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const app = new Vue({
formatURL: defaultFormatURL,
iframe: {
src: defaultFormatURL,
key: 0,
},
events: [],
},
Expand All @@ -29,6 +30,7 @@ const app = new Vue({
loadURL: function () {
console.log("Loading ", this.formatURL);
this.iframe.src = this.formatURL;
this.iframe.key = this.iframe.key + 1;
},
saveURL: function () {
localStorage.setItem(defaultURLLocalStorageKey, this.formatURL);
Expand Down
2 changes: 1 addition & 1 deletion devkit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Preview</h1>
<input v-on:click="forgetURL" type="button" value="Clear remembered URL" />
</div>
<div class="preview-container">
<iframe :src="iframe.src" id="preview-frame"></iframe>
<iframe :key="iframe.key" :src="iframe.src" id="preview-frame"></iframe>
</div>
</div>
</div>
Expand Down

0 comments on commit 56a8bd2

Please sign in to comment.