Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello,
I am developing an Embeded App for Shopify, and I have created an Extension that is on the Admin Product Page on the top menu that opens my App page.
On that page, I want to return to the admin product page that openned the App Page, so I tried to redirect directly to: "https://admin.shopify.com/store/mystore/products/8545732395300".
The problem is that shopify will show an error: Refused to display 'https://admin.shopify.com/' in a frame because it set 'X-Frame-Options' to 'deny'.
How can I do this? A simple redirect is not possible from an App?
Bet regards,
Ricardo
I also needed a feature like yours. Following the steps will likely be beneficial for you too. You can see detail. You can review the details in the document below.
https://shopify.dev/docs/api/app-bridge/previous-versions/actions/navigation/redirect-navigate
import {useAppBridge} from "@shopify/app-bridge-react";
import {Redirect} from '@shopify/app-bridge/actions';
export default function Create() {
const app = useAppBridge();
const redirect = Redirect.create(app);
redirect.dispatch(Redirect.Action.ADMIN_SECTION, {
name: Redirect.ResourceType.Product,
resource: {
id: '123',
}
});
}
Thank you for the answer, but my project is in C#... so I cannot use that...
I ended up with finding a solution, not perfect but a working solution...
string url = "https://admin.shopify.com/store/" + domain + "/products/" + shopifyProductId.ToString ("");
// Because the App opens in a Frame inside shopify, we need to pass the parameter "_top"
await jsRuntime.InvokeAsync<object> ("open", url, "_top");
With this solution, the url request jumps outside the IFrame used by shopify to display the App, and it works.