Created
October 20, 2023 15:47
-
-
Save hassanrazadev/2b7b819e10331c539b25bfb1f40d72f7 to your computer and use it in GitHub Desktop.
Reload Shopify embbeded app from ifram using App Bridge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <script src="https://cdn.jsdelivr.net/npm/@shopify/app-bridge@3.7.9/umd/index.min.js"></script> | |
const AppBridge = window['app-bridge']; | |
const createApp = AppBridge.default; | |
const Redirect = AppBridge.actions.Redirect; | |
const shopifyApp = createApp({ | |
apiKey: "api_key", | |
host: new URLSearchParams(document.referrer).get("host"), | |
forceRedirect: true | |
}); | |
const redirect = Redirect.create(shopifyApp); | |
// fnially, reload the main page | |
redirect.dispatch(Redirect.Action.REMOTE, document.referrer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment