Web developers, accessibility auditors, and QA engineers frequently need to evaluate how websites adapt to different devices, screen orientations, and client software. Many modern websites employ server-side browser detection or client-side capability sniffing to serve mobile layouts, conditionally load polyfills, or restrict legacy web features based on the incoming User-Agent header.
In Safari on macOS, Apple provides native developer tools that allow you to switch your browser identity on the fly. By overriding the User-Agent string, you can test how web servers render pages for Google Chrome, Mozilla Firefox, Microsoft Edge, or mobile devices (iPhone and iPad) without installing secondary browsers or leaving Safari.
Enabling the Develop Menu in Safari
The controls for overriding User-Agent strings are located within Safari’s advanced Develop menu, which is hidden by default in standard installations:
- Launch Safari on your Mac.
- Click Safari in the top menu bar and select Settings… (or press Cmd + ,).
- Select the Advanced tab.
- At the bottom of the window, check the box labelled Show features for web developers (in earlier macOS versions, this is labelled Show Develop menu in menu bar).
- Close the Settings window. You will now observe a new Develop menu situated in the menu bar between Bookmarks and Window.
Switching Between Preset User-Agent Profiles
Safari includes pre-configured User-Agent strings for the most common desktop and mobile environments:
- Navigate to the webpage you wish to test in Safari.
- Click the Develop menu in the menu bar.
- Hover over User Agent.
- Select one of the built-in profiles:
- Safari — iOS (iPhone): Forces servers to transmit responsive mobile web templates and touch-optimized assets.
- Safari — iPadOS (iPad): Emulates tablet rendering modes.
- Google Chrome — macOS or Google Chrome — Windows: Tests whether a site is unnecessarily blocking Safari via UA sniffing.
- Mozilla Firefox — macOS or Mozilla Firefox — Windows.
- Microsoft Edge — macOS.
Upon selecting a profile, Safari immediately reloads the active tab using the selected User-Agent string in the HTTP request headers.
Configuring a Custom User-Agent String
When diagnosing rare enterprise browser requirements, bot crawl behaviors (such as Googlebot), or specific version regressions:
- Open the Develop menu and navigate to User Agent.
- Click Other… at the bottom of the submenu.
- A configuration dialog box appears displaying the current User-Agent string.
- Replace the string with your desired identifier. For example, to emulate the Googlebot web crawler:
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) - Click OK.
Safari reloads the webpage, presenting the custom string to the remote web server and exposing the navigator.userAgent property in client-side JavaScript.
Verifying the Active User-Agent in Web Inspector
To confirm that your custom User-Agent is being transmitted correctly to the remote server:
- Right-click anywhere on the webpage and select Inspect Element to launch Safari Web Inspector.
- Switch to the Console tab.
- Type
navigator.userAgentand press Enter. - Verify that the returned string matches your selected profile.
- Switch to the Network tab, reload the page, select the document request, and inspect the Request Headers to verify the live
User-Agent:HTTP header.
Resetting to Default Safari Identity
Safari retains your custom User-Agent selection exclusively for the active tab. However, when your testing session is finished, return to default browsing:
- Click Develop > User Agent.
- Select Default (Automatically Chosen).
This restores your native macOS Sequoia Safari identity, ensuring regular browsing privacy and standard web compatibility.