Menu
Menu Sheet Overlay
Search
Search Sheet

      Using Mobify Preview with Automation Tools

      There will be times when you would like an automation tool (e.g. SEO crawler, WebPagetest) to work with a non-published bundle. This is a bundle that has been pushed to Cloud but it's not published yet because it's not ready for production.

      Since the bundle is not published yet, you would have to preview this bundle. But the act of visiting the Mobify Preview page breaks your automation tool from working properly. Thus, we need a way to bypass/skip it.

      This is how you would bypass the Mobify Preview page:

      1. Push your code bundle to Mobify Cloud, if you haven't done it yet
        • This step ensures that your automation tool has access to that bundle
      2. Perform the preview normally, as if you're doing it for yourself
      3. Copy the URL of the page you are redirected to. This URL should be long and have a hash at the end of it.
      4. Then configure your automation tool to use one of these:
        • a custom user agent
        • or a custom http header
      5. Pass the copied page URL (from Step 2) into your automation tool

      Custom user agent

      Does your automation tool allow you to use a custom user agent? If yes, then construct a user agent that has MobifyPreview in it:

      1. Start with your current user agent, which has to be one of the supported browsers for Progressive Web Apps (see our compatibility matrix)
      2. Then append MobifyPreview to it

      For example, appending MobifyPreview to iPhone 8 Safari's user agent would give us:
      Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1 MobifyPreview

      Custom HTTP header

      If your automation tool allows you to use a custom HTTP header, then this is the easier way. The custom header is X-Mobify-Preview: 1.

      For example, in WebPagetest, you could customize the HTTP header within its Advanced Settings:

      'Custom headers' field

      IN THIS ARTICLE:

      Feedback

      Was this page helpful?