Inspecting elements on an iPhone lets web developers and testers directly view and modify a webpage’s code. It helps identify problems like non-functioning buttons, incorrect styling, overlapping text, and other HTML-related issues. You can also use it to see how your site looks on different screen sizes and devices, and spot layout problems.
This guide will give you four different ways to inspect elements on iPhone devices and test your website on real devices.
Different Ways to Inspect Element on iPhone Devices
Listed below are the different ways to inspect elements on any iPhone devices
- Using Safari developer tools to inspect elements on an actual device
- Using iPhone Devices on BrowserStack
- Debug using the Web Inspector feature
- Adobe Edge Inspect
Method 1: Using Safari developer tools to inspect elements on an actual device
Apple provides a simple way for developers to debug and inspect web elements on iPhones and iPads using Safari’s Web Inspector. Here’s how:
Step 1: Enable Web Inspector on Your iPhone
Go to Settings > Safari > Advanced on your iPhone and turn on the Web Inspector.
Note: This feature only works with Safari on macOS, not on Windows.
Step 2: Open the Safari browser, go to Safari > Preferences > Advanced, and check the box for Show Develop menu in the menu bar.
Step 3: Connect and Inspect
Connect your iPhone to your Mac. Open Safari’s Develop menu, select the connected iPhone and the active web page you want to inspect. This will open the Web Inspector for that page.
Real-Time Interaction: Inspecting an element in the Web Inspector highlights the corresponding element on the connected iPhone in real-time, offering developers an interactive and accurate debugging experience.
Method 2: Using iPhone Devices on BrowserStack
BrowserStack is a cloud-based platform that enables web developers and QA teams to test web apps for cross-browser compatibility on a wide range of devices. It offers manual testing on real mobile and desktop devices through its real device cloud and automated testing via the Cloud Selenium Grid.
Additionally, developers can access developer tools for Android and iOS during live testing, making it easy to debug and test websites on various iOS devices like iPhone 15, 14, and 13 across preferred browsers.
Steps to Inspect Elements on iPhone 15 Using BrowserStack:
- Sign up for free on BrowserStack Live.
- Select iOS > iPhone 15 with Safari browser and wait for the device to boot.
- Navigate to www.browserstack.com in the Safari browser.
- Right-click on the desired element (e.g., a button) and select Safari Web Inspector.
- Use the Elements tab to edit the text, such as changing “App & Browser Testing Made Easy” to “Let’s Start Testing.”
Note: These changes are not permanent and just apply to the current session. Using this feature helps you simulate situations you might encounter during your testing.
Method 3: Debug using the Web Inspector feature on iPhones or iPads
Apple has a web inspector feature that allows developers and testers to debug their web pages from their mobile phones. Before, we see how to inspect elements on iPhone using this option, let us take a look at the requirements. To perform this,you will need two things.
- Your deployment machine
- The device on which you want to test the webpage or app.
Getting all the devices on which you want to inspect and test is quite a difficult task. This is as good as maintaining an in house device library. But, the problem with maintaining one is the high setup and maintenance cost that it comes with. You will have to ensure that the devices are updated, and well maintained. And, even if you were to do that, you will be able to test one version of the browser. What would you do if you want to test an older version?
Also Read: Remote Debugging on iOS and Mac Safari
These are a few fallbacks with this method. However, BrowserStack overcomes all these issues by providing you with a real device cloud, that allows you to access any device and version that you want.
That said, we have listed the detailed steps to debug using the web inspector feature on iPhones or iPads in this article. Please head over to the above link to know more.
Method 4: Inspect using Adobe Edge
Adobe Edge Inspect is one of the easy methods to inspect elements on any iPhone device. Adobe has discontinued this feature, but you can find the source for this on the internet. Therefore using this poses a security threat and should be used with discretion. The user using this would be liable for any data leak or security concerns.
Adobe Edge Inspect does not require a mac operating system and can be accessed from windows as well. As it supports synchronized browsing the web page that you open will be synced with all the devices that are connected to the system.
Adobe Edge inspect does not support local testing. Learn how to test Local Website on mobile.
Now let us see how to use Adobe Edge Inspect:
- Download their software on the deployment system and ensure that all the devices that you want to test are connected to the same wifi. The sync happens by establishing the connection via wifi.
- Next, open the website. You will notice that the website opens up on all the devices that are connected to the deployment machine. There will be a debug sign next to the device name.
- Select the debug sign for the device you want to inspect.
You will now have access to the developer tools and can start inspecting.
Given all the four options and the concerns associated with it, it is best to choose BrowserStack to inspect elements on your iPhone.
How to Inspect Element on iPhone Without a Computer Using JavaScript Bookmarklets?
You can inspect elements on your iPhone without a computer using JavaScript bookmarklets. JavaScript bookmarklets are small JavaScript snippets saved as browser bookmarks that help you view page source or inspect content.
Here are the steps:
Step 1: Enable Safari Bookmarks
Ensure Safari is enabled for bookmarks in iCloud settings.
Step 2: Create a New Bookmark
- Open Safari on your iPhone.
- Visit any webpage (e.g., google.com).
- Tap the Share icon (square with arrow).
- Tap Add Bookmark.
- Save it with a name. For example: Inspect This Page
- Tap Save.
Step 3: Edit the Bookmark to Add JavaScript
1. Tap the Bookmarks icon (open book symbol).
2. Find the bookmark you just saved.
3. Tap Edit.
4. Replace the URL field with the following JavaScript:
javascript:(function() { var source = document.documentElement.outerHTML; var win = window.open(); win.document.open(); win.document.write('<pre style="white-space: pre-wrap; word-wrap: break-word;">' + source.replace(/</g, '<') + '</pre>'); win.document.close(); })();
5. Tap ‘Done’ and save changes
Step 4: Use the Bookmarklet to Inspect Elements
- Visit any webpage preferred for inspecting.
- Tap the Bookmarks icon.
- Tap your Inspect This Page bookmark.
- A new tab will open showing the HTML source of the page.
Read More: Top 9 JavaScript Testing Frameworks
How to Inspect Element in Google Chrome iPhone
Google Chrome on iOS does not natively support developer tools or inspection features because iOS forces all browsers (including Chrome) to use WebKit, the same engine as Safari. That means Chrome on iPhone is just Safari underneath, and it doesn’t have developer tools like the desktop version.
However, you can use JavaScript Bookmarklet, online “View Source” Tools or a developer app to inspect elements on iPhone Google Chrome.
You can open the online ‘view source’ tool in Chrome, paste the link you want to inspect and submit to view the full HTML structure.
As for developer apps, you can simply download them and leverage them easily as their working is similar to that of Chrome DevTools.
Now, you can learn how to use JavaScript Bookmarklet to inspect elements in Chrome on Iphone. Here are the steps:
- Open Chrome on your iPhone.
- Visit any page and bookmark it.
- Go to Bookmarks > Edit your new bookmark.
- Replace the URL with this JavaScript code:
javascript:(function() { var source = document.documentElement.outerHTML; var win = window.open(); win.document.open(); win.document.write('<pre style="white-space:pre-wrap;word-wrap:break-word;">' + source.replace(/</g,'<') + '</pre>'); win.document.close(); })();
- Save it.
- Visit any page, open your bookmarks, and tap the bookmarklet to view the source.
Best Practices for Using Inspect Element on iPhone
Here are the best practices to follow inspecting element on iPhone:
- Use DevTools Apps: Apps like Inspect Browser provide a desktop-like inspection experience, letting you view the DOM, CSS, and console directly on your iPhone.
- Create Bookmarklets: Bookmarklets are small JavaScript tools saved as bookmarks. You can use them to view HTML source or image links with a single tap.
- Use “Request Desktop Site”: Switching to the desktop version of a site helps you inspect responsive layouts more accurately, especially when combined with other tools.
- Avoid Sensitive Pages: Don’t use inspect tools on login or banking pages, as they may block scripts or pose security risks.
- Use Real Devices: Testing directly on real iPhones via a real-device cloud can give the most accurate results for layout, performance, and behavior, far more reliable than emulators or simulators.
Why Inspect Elements on iOS using Real Device Cloud?
All of these approaches give you the platform to check how your applications function on Safari and the experiences that your users will get. Though each uses the same Safari developer tools, the option to use a real device cloud such as BrowserStack, gives you an edge.
With BrowserStack, you can combine the inherent inspect elements feature offered by Safari with the range of Browserstack features such as, access to real devices, testing your mobile application in staging, test for media capabilities, scenarios related to sim cards, location tests, accessibility testing, and much more.
Also read: How to test mobile applications manually
Conclusion
Inspecting elements on iPhone helps developers and testers view and modify website code directly from their devices. It helps identify design and layout issues, test responsiveness, and make quick adjustments. Use any of the four methods mentioned above to inspect element and improve your website.
BrowserStack provides access to more than 3500+ browser combinations, a real device cloud that can empower your developers to test your applications expansively. You can see how your applications perform on popular devices and browser combinations.