Intercept web traffic

How to intercept web traffic and manipulate webpages?

AppMySite offers a straightforward method to achieve intercepting web traffic and manipulating web pages. Follow these steps to get started:

Step 1: Enable the "Append App Code Version in User Agent" Toggle

  • Access your AppMySite dashboard.

  • Navigate to the Web view settings of the app you wish to configure.

  • Turn the toggle on for "Append app code version in User Agent".

Step 2: Add the User-Agent Key in Your Website Header

  • Once you enable the toggle, AppMySite will modify the User-Agent header when loading the web-view in the app's browser. The app will append the APICodeVersion of the app to the User-Agent. For instance, the User-Agent string will look like this: APICodeVersion/1.18.9

  • To detect this User-Agent in your website’s code, use the following standard PHP syntax: $user_agent = $_SERVER['HTTP_USER_AGENT'];

  • Once you have detected the User-Agent using the above PHP code, you can then manipulate your website’s functionality based on the APICodeVersion value to customize how your web content behaves in the app’s web-view.

With the User-Agent string configured, you can manipulate the web page loaded within the app's web view. Depending on your requirements, you can inject custom CSS, add analytics script or implement any other code necessary to customize the user experience within the web view.

Last updated