When I try to redirect the merchant from my app to a Shopify charge / pricing / subscription page, I get the following error:
Unsafe attempt to initiate navigation for frame with origin ‘https://admin.shopify.com’
from frame with URL ‘https:///shopify/app/…’.
The frame attempting navigation of the top-level window is sandboxed and not allowed.
But when I redirect from Product page which is in shopify editor to charge page over there I have kept one button when click on that than I get error, and main issue is can’t use App Bridge on extension side
Hi @Gaurav_Sharma2,
The issue you’re seeing happens because your app (or extension) is embedded inside Shopify Admin or the Online Store editor. Shopify blocks top-level redirects from sandboxed iframes for security reasons. That’s why window.location or window.top.location won’t work, and App Bridge is normally required for proper redirects.
Since App Bridge isn’t available in your extension, the next best approach is to open the charge/pricing/subscription page in a new browser tab. For example:
Copy code
Javascript
const confirmationUrl = ‘https://shopify.com/…’; // your charge/subscription URL
window.open(confirmationUrl, ‘_blank’); // opens in a new tab
This way, the merchant can complete the billing flow without running into sandbox restrictions.
Other options (less reliable):
Redirect via your server: Have the extension button call your server, which returns a page that tries to redirect. Shopify may still block this in some cases.
Trigger the billing flow from the main app (where App Bridge is available) instead of the extension.
Rule of thumb:
Billing/charge pages → always use App Bridge redirect when possible.
Extensions without App Bridge → use new tab/window for safe navigation.
This is the approach most developers take for extensions inside the Online Store editor.
Hi @Ozed_Digital From product page I am redirecting it to new tab only, on that page there is pricings and button Start your trial when click it redirects to approve payment, but when I’m clicking on Start your trial btn It’s giving me error, while i open the approve payment link directly in new tab by pasting link without redirecting than its work fine, the issue is in Product Page, Cart Page
This error happens because your app is running in a sandboxed iframe, which prevents it from navigating the parent window ( admin.shopify.com ) directly via standard server-side redirects or simple window.location calls. To fix this, you must use App Bridge to perform a ‘Top-level’ redirect.
Hi @Michael-50 Main issue is can’t use App Bridge on extension side in my Product page which is in shopify editor