--- title: "Addressing Security-Related Errors for iPhone Users" slug: "addressing-security-related-errors-for-iphone-users" updated: 2025-01-28T19:15:12Z published: 2025-01-28T19:15:12Z canonical: "docs.blackthorn.io/addressing-security-related-errors-for-iphone-users" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.blackthorn.io/llms.txt > Use this file to discover all available pages before exploring further. # Addressing Security-Related Errors for iPhone Users This document outlines a solution to resolve security-related errors encountered when using TouchNet as a Payment Gateway within an iframe on Apple devices. This approach leverages client-side JavaScript to adapt the behavior based on the device type, ensuring a seamless user experience. ## Background ### The Problem Apple device users experience a security-related error and cannot continue registering for an Event when the Event is in an iframe, and the Payment Gateway is TouchNet. The security restrictions (e.g., cross-site scripting rules) prevent cross-domain redirects within iframes, which results in the following. - Session cookies and security headers are blocked. - An error interrupts the user’s ability to complete transactions. In short, TouchNet’s architecture includes a redirect that occurs within an iframe, which is considered a security issue and blocked by Apple. #### Sample Use Case: An organization’s mobile app uses iframes to display Events. Because of Apple’s restrictions, TouchNet's redirect flow fails, requiring an alternative solution. ### Recommended Solution We suggest customers use client-side JavaScript to: - Detect if the potential Attendee is on an iPhone. - Open the Event in a new window for iPhone users. - Continue loading the Event in an iframe for other devices. ## Technical Solution ### Why TouchNet and Iframes Don’t Work on Apple Devices TouchNet’s cross-domain redirect flow is incompatible with iframes on Apple devices because: - Session cookies and security headers cannot be securely shared across domains in an iframe. - Apple's browser policies block such redirects for security reasons. ### Key Elements of the Solution - **Device Detection:** Check the `navigator.userAgent` to identify iPhone users. - **Dynamic Behavior:** - For iPhone users, open the Event in a new window using `window.open`. - For other devices, load the TouchNet script dynamically into an iframe. - **Responsiveness:** The script ensures a consistent and user-friendly interface on all devices. ## How It Works 1. **Device Detection:** The `isIPhone` function checks the `navigator.userAgent` to identify iPhone users. 2. **Dynamic Behavior:** - For iPhone Users: - Users see a message and the **Open Event** button. - After clicking the **Open Event** button, the Event opens in a new window using `window.open`. - For Other Devices: - The TouchNet script is dynamically added to the page, and the page loads in an iframe. ## Implementation Steps Critical Step The script must be added to the hosting page and cannot be managed within the Blackthorn Events application. 1. **Update HTML:** Replace your existing iframe setup with the provided HTML structure and script. 2. **Customize Parameters:** Replace `scriptPath` with the [data path specific to your Event](https://docs.blackthorn.io/docs/blackthorn-events-iframes#scripts). 3. **Deploy and Test:** 1. Upload the updated HTML to your server. 2. Test the implementation on both iPhone and non-iPhone devices. ## Sample Code [Embedded content](https://www.youtube.com/embed/V_o-IxmDoZ0) Copy and paste this code in the `body` tag. ```
``` Here is the complete HTML code with the solution embedded and some CSS changes. ```