Contact form post in preview returns to live site - leaves preview

I am adding a new custom contact form. It works perfectly in the theme preview on desktop. On successful return from form submission, it redirects to a different page.

On mobile, the form submission leaves the preview and returns to the live theme (site) which does not have the new code. I have verified that it returns to the live theme rather than the preview by noting the following:

  1. The displayed page content is exactly equal to the live theme - since this is a new page, the live theme has only a few characters content for this page.

  2. The preview bar at the bottom of the screen is not displayed upon return from the form submission but is there before.

Has anyone else had this problem? We also had the captcha problem but had it turned off today and now see that the form submission returns to the live theme rather than the preview.

How can I thoroughly test my theme changes on mobile if the theme preview doesn’t work through all page actions?

Please help! This is urgent!

Can you share your code? Are you using the theme preview at the ‘shopifypreview.com’ domain?

Sharing my code won’t help explain why the preview (accessed from Shopify Admin Themes>My theme>Actions>Preview) works flawlessly on one platform (desktop) and loses the preview mode completely and reverts to the live theme on another platform. As I said, the live theme version of the page has just a sentence of text while the “My theme” (not live) version contains a form and a BUNCH of code. I can accept that there might be a bug/error in my code. What kind of error could I possibly create that would cause the preview to fall out completely to the live site? That shouldn’t be even possible.

Can anyone from Shopify comment on this? In my opinion the Preview feature should be a ‘sandbox’ that can’t be broken out of by any code. Does Shopify agree with this statement?

Update: We published the theme that we had this problem with in Preview. The code works perfectly on both desktop and mobile (iphone and android). So it was, in fact, only a problem with the Preview feature of Shopify themes.