Debug iPad Safari with a PC
Asked Answered
N

10

78

I want to test my website on Safari on my iPad. I only have another PC. Is there a way for me to do remote debugging like ADB (Android Debug Bridge) with mobile Chrome? I searched on StackOverflow, seems there is an Adobe Edge Inspect CC, but I don't know if this is a good choice.

Thanks!

Nogging answered 5/12, 2013 at 18:46 Comment(0)
B
18

2018 Update:

Since the original post, the blog post is dead & Telerik App Builder is discontinued and no longer offered. Adding this update to inform readers in case they don't read the user comments that follow this answer post. As for the blog post, for those still interested, here's a web cached copy. Regarding the blog, I think the company that blog's from has since shut down.

When I get a chance, I'll see if I have a copy of the app builder saved so that I can post it online for those still interested in using it, along with another cached copy of the blog post maybe.

Original Answer

You can try option of using Telerik AppBuilder (Windows client) as a replacement on Windows for Safari debugger on Mac when remote debugging. There's a nice blog post about the steps to do it in link below. I'd rather not repost the info as there are also screenshots and it's a lot of text. But essentially, you install app, open it, connect device via USB, then you can find it in the app and open up the developer tools/debugger for it. For non-public websites, you'll have to open up port 80 with some firewall configs documented in the post.

http://blog.falafel.com/Blogs/josh-eastburn/2014/03/04/ios-web-inspector-on-windows-with-telerik-appbuilder

The tool requires a license or you can use the trial, which becomes a basic edition afterwards. I think the basic edition will still allow you to do the debugging. I'm going to try it out myself.

You can also try these iOS apps too, you can find them in the iTunes App store. They give you a built in developer tools feature (right on iOS no remote debug) that mobile Safari doesn't offer.

MIH Tool - basic edition https://itunes.apple.com/us/app/mihtool/id584739126?ls=1&mt=8

HTTPWatch Basic https://itunes.apple.com/us/app/httpwatch-basic-http-sniffer/id658886056?mt=8

I gave them a try and they're at least better than the mobile Safari you get on iOS, unless one needs to target full mobile Safari compatibility. I'm guessing the pro/paid editions of those apps give you more/better features.

Broadbrim answered 12/6, 2014 at 1:25 Comment(9)
With the latest version of AppBuilder 2016.04.14.2 and iOS 9.1 I cannot get that to work according to the blog post. AppBuilder does not display the Web Inspector anymore. Anyone having similar issues?Dolor
The telerik option seems to require having an apple developer account and I was never able to get my device connect. I don't do any apple development, I just need to inspect and debug safari html/css defect.Aforesaid
The blog link is dead and Telerik Appbuilder is not accessible anymore : docs.telerik.com/platform/appbuilder/discontinuationDigestif
That is unfortunate, it was good tool. I'll see if I have a cached copy locally somewhere that I could put up. But best to find other solutions now.Broadbrim
For those that might have copy of the old Appbuilder, here's cached copy of the tutorial: webcache.googleusercontent.com/search?q=cache:https://…Broadbrim
Blog site is down.Enjambment
The telerik app builder was retiredEnjambment
Do this still work? I've not been able to intall the npm package. It seems its not found.. An updated answer to this question would be very appreciated!Jeavons
Did you not read the 2018 update? The tool is "gone" sadly.Broadbrim
F
93

Update October 2019

This solution doesn't work for IOS 12+ (resource 1, resource 2).

Updated and tested on 24/6/2017

Using Chrome on Windows 8 and more recent:

  • Download and install Node
  • Download and install ITunes and connect it to your Device. (A pop-up should shows to your iPad to get authorization) . Be sure to allow web inspector in your iPad

  • Download and install the remote webkit adapter

Using Powershell (As administrator):

npm install remotedebug-ios-webkit-adapter -g

  • Execute the adapter:

Using Powershell (as administrator):

remotedebug_ios_webkit_adapter --port=9000

You should get a similar output:

C:\Windows\system32> remotedebug_ios_webkit_adapter --port=9000 remotedebug-ios-webkit-adapter is listening on port 9000 iosAdapter.getTargets ...

  • Open Chrome and go to the following link:

chrome://inspect/#devices

  • Click on configure next to "Discover network targets" and add the following: localhost:9000

Make sure to have the web page you want debug open on safari, you should see it on chrome inspector page under Remote Target

Extra step for iOS 11 Thanks to @skaurus

Feinstein answered 5/8, 2016 at 10:7 Comment(16)
Excellent, this is by far the easiest solution. You can also use the built in DevTools by going to this link chrome-devtools://devtools/bundled/inspector.html?ws=localhost:9222/devtools/page/1Alodie
I have tried the above on Windows 10, with Chrome and Canary, but Browser does not find device. I downloaded the latest iTunes today, executed iTunes with admin priv. and the same with the ios...proxy.exe. any thoughts?Mariselamarish
@Mariselamarish Is the webkit-debug-proxy showing an output similar to the one above?Feinstein
@Lemmy4555: Yes. It found and connected to my iPad. The issue may be https. I need to debug with https for my web app. Any idea if https is supported? Thanks...Mariselamarish
@Lemmy4555 Here is an error that displays in the developer tools: WebSocket connection to 'ws://localhost:9222/devtools/page/1' failed: Error during WebSocket handshake: Unexpected response code: 404 WebInspector.loaded @ DevTools.js:3104Mariselamarish
@Lemmy4555 A note for ios_webkit_debug_proxy.exe states: Due to security reasons, https URLs will not work; use http or force-allow with the URL bar's shield icon. Not sure that this is the reason for my error above, since I did not get any security shield icon error. Thanks for your response.Mariselamarish
@Lemmy4555 What URL bar shield icon? In chrome, I see an i in a circle on one side, and a star on the other. In Safari, I see what looks like an 'align left' icon on one side, and the refresh icon on the other. Where should this shield be?Duren
@Duren The schield icon means that page contains unsafe scripts, if it's not displaying don't care about it.Feinstein
The Firefox/Valence method seems to be much more stable now. You may have issues using the latest Inspector, that I previously suggested, as the protocols for debugging Chrome and Safari started to diverge too much - see github.com/google/ios-webkit-debug-proxy#devtools-noteAlodie
Managed to get this working in Windows 10 with iOS10. I needed to download the x64 build of the debugging proxy as the other build threw errors (Direct Link: sourceforge.net/projects/ios-webkit-debug-proxy-win32/files/…) Also the URL blade provided didn't work for me, only the second URL did.Gemmation
I got this to work on Windows 7 and iOS 10.3.2. @BenShelton's comment / solution got it working for me. Also had to update to the most current Chrome at time of writing Version 59.0.3071.115 (Official Build) (64-bit). iTunes 12.5.5.5 - not sure that mattersUnconformity
This was not working for me on Win 10 + iOS 11, but I found a solution here: github.com/RemoteDebug/remotedebug-ios-webkit-adapter/issues/79Infective
If you're behind a company proxy there's an additional step needed. In adapter.js and iosAdapter.js change "request(this._url)" to "request({'url':this._url, 'proxy': ''}"Monastery
This Answer is the perfect solution to be implemented, thank for this... But on web inspecting, after a while the Styles panel stucks and its doesnt show me the respective classes implemented on elements.. Did anyone else faced the issue?Appling
Confirming that this is a working solution for Win 10 + iOS 10.Pentha
This is also working for me. The only thing that was not mentioned that I had to do before it worked, was restarting my PC after installing iTunes.Menhir
B
32

See monkeythedev's answer for the easiest way to debug on a Windows 8+ machine with iOS 9+. I updated my blog post using information from that answer and other sources and also recorded a screenshare. The method below should still work for iOS 8 and down, if needed.

There is actually a pretty easy way to debug a website in Safari on iOS using Firefox on a Windows machine.

NOTE: Ryan wrote in the comments below that this may only work on iOS 8 and down. I am unable to confirm, but be aware.

I wrote a detailed blog post about this, but here are the highlights:

  1. Install iTunes to get the "Apple Mobile Device Support" and "Apple Application Support" applications that come with it. (uninstall iTunes afterward, if you want)
  2. Connect your iOS device via USB.
  3. Enable web inspector on iOS (available on iOS 6 and later).
  4. Open Safari on your iOS device and browse to a website.
  5. Open Firefox on your Windows machine and press Shift + F8 to open WebIDE, which should include the necessary Valance add-on, if you use Firefox Developer Edition (any version) or Firefox 37 and later (any channel).
  6. For some reason, I couldn't get it to connect to my iOS device until I downloaded the ios-webkit-debug-proxy-win32 program and ran it. It opens a blank Command Prompt, but after I went back to WebIDE after opening it, I disconnected, then reconnected, and I saw debug info for the website I had opened in Safari. You may not need to do this though, as another user just had to add an exception to their firewall then disconnect/reconnect, and it worked.

The debug info available isn't as exhaustive as Chrome Developer Tools (specifically no "Networking" tab), but it was enough for me to be able to view what was going on in the Console.

enter image description here

Broadway answered 1/3, 2016 at 4:43 Comment(5)
FYI, for the iTunes (driver/library) dependencies, if one doesn't want to install (then uninstall) iTunes, you could use a MSI/EXE extractor tool (or equivalent like WinRAR) to view/extract the iTunes installer content like a zip file, then keep only the driver/library files. They are the MSI files with the names mentioned. I always hated installing/using iTunes. The drivers are good to keep and reuse until you need new drivers (say for new Apple devices, new features, etc.)Broadbrim
I did not have to install the ios-webkit-proxy-win32 but I did get a firewall warning when I clicked to open the safari device. I made an exception but it still didn't work the first time, but after I disconnected and reconnected it worked great. This solution is by far the easiest I've found after hours of searching, you sir deserve all the upvotes.Aforesaid
As per this thread (github.com/mozilla/valence/issues/199), there seems to be some issues using this method with iOS 9Fervency
I also had to download ios-webkit-debug-proxy-win32 (had to take the ios-webkit-debug-proxy-mingw32 version). Still it didn't work. Then I clicked "Chrome Desktop" in the WebIDE and now it works!Ackerley
I don't think it works past iOS 8, as mentioned here: developer.mozilla.org/en-US/docs/Tools/Valence. It's not working for me on iOS 10.Insphere
B
18

2018 Update:

Since the original post, the blog post is dead & Telerik App Builder is discontinued and no longer offered. Adding this update to inform readers in case they don't read the user comments that follow this answer post. As for the blog post, for those still interested, here's a web cached copy. Regarding the blog, I think the company that blog's from has since shut down.

When I get a chance, I'll see if I have a copy of the app builder saved so that I can post it online for those still interested in using it, along with another cached copy of the blog post maybe.

Original Answer

You can try option of using Telerik AppBuilder (Windows client) as a replacement on Windows for Safari debugger on Mac when remote debugging. There's a nice blog post about the steps to do it in link below. I'd rather not repost the info as there are also screenshots and it's a lot of text. But essentially, you install app, open it, connect device via USB, then you can find it in the app and open up the developer tools/debugger for it. For non-public websites, you'll have to open up port 80 with some firewall configs documented in the post.

http://blog.falafel.com/Blogs/josh-eastburn/2014/03/04/ios-web-inspector-on-windows-with-telerik-appbuilder

The tool requires a license or you can use the trial, which becomes a basic edition afterwards. I think the basic edition will still allow you to do the debugging. I'm going to try it out myself.

You can also try these iOS apps too, you can find them in the iTunes App store. They give you a built in developer tools feature (right on iOS no remote debug) that mobile Safari doesn't offer.

MIH Tool - basic edition https://itunes.apple.com/us/app/mihtool/id584739126?ls=1&mt=8

HTTPWatch Basic https://itunes.apple.com/us/app/httpwatch-basic-http-sniffer/id658886056?mt=8

I gave them a try and they're at least better than the mobile Safari you get on iOS, unless one needs to target full mobile Safari compatibility. I'm guessing the pro/paid editions of those apps give you more/better features.

Broadbrim answered 12/6, 2014 at 1:25 Comment(9)
With the latest version of AppBuilder 2016.04.14.2 and iOS 9.1 I cannot get that to work according to the blog post. AppBuilder does not display the Web Inspector anymore. Anyone having similar issues?Dolor
The telerik option seems to require having an apple developer account and I was never able to get my device connect. I don't do any apple development, I just need to inspect and debug safari html/css defect.Aforesaid
The blog link is dead and Telerik Appbuilder is not accessible anymore : docs.telerik.com/platform/appbuilder/discontinuationDigestif
That is unfortunate, it was good tool. I'll see if I have a cached copy locally somewhere that I could put up. But best to find other solutions now.Broadbrim
For those that might have copy of the old Appbuilder, here's cached copy of the tutorial: webcache.googleusercontent.com/search?q=cache:https://…Broadbrim
Blog site is down.Enjambment
The telerik app builder was retiredEnjambment
Do this still work? I've not been able to intall the npm package. It seems its not found.. An updated answer to this question would be very appreciated!Jeavons
Did you not read the 2018 update? The tool is "gone" sadly.Broadbrim
G
9

This question was more than 4 years ago, but I feel like it's worth to mention another option which is platform-independent which seems is not mentioned above:

VConsole

It's a JavaScript that you can inject into your page(s) which will overwrite all native console output and show it as an overlay on top of your page content, in a level of detail that is almost as good as Google Chrome's Developer Tools.

Runs well on iOS Safari, as well as on other mobile browsers - for as long as JavaScript is enabled in the browser.

How to install: https://www.npmjs.com/package/vconsole

You will need NPM tools to install it, but not actually required to use NPM to build your project. You can simply install VConsole somewhere in a separate folder, and just copy-paste vconsole.min.js from it.

Once you inject it into your page, will look like this:

<script type="text/javascript" src="vconsole.min.js"></script>
<script type="text/javascript>let vc = new VConsole(); // this will initialize it.</script>

Visually is very appealing, you will see green button in lower-right corner of your page on your mobile/desktop browser, which will open console overlay.

Very neat!

Of course, it does not provide you with ability to select an element, see calculated css etc., but if you are looking for console output and some network report, this one is really easy to use.

Gilmour answered 16/6, 2018 at 15:41 Comment(3)
Made my day! Since jsconsole.com was shut down I was looking for a tool like this! Debugging for Iphone gives me always a tough time but this tool is awesome. By just adding a few lines to the page I finally get useful debug messages. Thank you :)Lashonda
@Lashonda My pleasure!Pet
This is a gem! Easiest solution by far if you just want some simple debugging.Contrast
A
6

October 2019

AFAIK, For recent IOS versions there is no overall solution for debugging IOS from a PC.

You can however use one of the following solutions:

  1. Display console messages in the browser itself. As described here and in Sinisa's answer.
  2. The "remotedebug-ios-webkit-adapter" doesn't work for debugging IOS 12+. It requires extra steps for IOS 11, and works for IOS 10 and perhaps older versions as well.
Almucantar answered 22/10, 2019 at 9:10 Comment(3)
My current issue is that the in-app javascript console does not output anything from my other tabs in chrome on the iPad. Also, both your links lead to the same url. It is sad that one of the richest tech companies in the world can't figure out a way for developers to debug simple websites without the help of tech-savvy windows/linux users.Navarra
@JohnF, Not sure I understand your current issue.Almucantar
JohnF. They want you to buy a Mac, you can debug from thatMonastery
C
1

I use PrePros for CSS preprocessing and it has a built in server for mobile debugging and web inspector. But this is only good for local sites even still...

Cohosh answered 16/4, 2014 at 22:37 Comment(0)
I
1

In my experience it is often not an issue with mobile Safari only but Safari in general. In these cases it can help to try the normal Safari (for Windows) and see if the bugs appear there. If so, it's much easier to debug something by this way.

Ibrahim answered 26/2, 2015 at 14:55 Comment(4)
Testing on mac might help, but not on windows as safari is outdated and not maintained anymore.Pleach
On my iPad2 (iOS 8.3) in the advanced settings of Safari it says: "To use the WebInspector, connect to Safari on your computer using a cable and access your iPad from the Develop menu. You can enable the Develop menu in Safari's Advanced Preferences on your computer". I could enable the Develop menu on my Safari5.1.7 on Windows8. However from there I don't know how to start the debugger of a html page shown in the Safari of my iPad.Logistic
Stonecrusher: I don't think its the same developer mode as required to remotely debug on an iPad.Ibrahim
safari 5 is the latest available for windows. This version is completely outdated...Erythrocyte
L
1

2021 update:

The creator of RemoteDebug here. I've built a replacement for RemoteDebug called Inspect, which packages everything together in a pleasant experience and enables easy iOS web debugging from Windows, macOS, and Linux, with a few extra features like screencasting and wifi debugging.

http://inspect.dev

Lilas answered 1/7, 2021 at 3:56 Comment(0)
D
0

There are a couple of options I've come across for debugging on iOS. They're not full step-through debuggers, but they offer a JS error log, console and some inspection tools:

1. Eruda

By adding the following snippet to the top of your page:

<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script>

You get an interactive set of developer tools similar to those in Chrome and Firefox. Here's a screenshot:

Eruda Screenshot

Available at https://github.com/liriliri/eruda

2. MiniConsole

This one I developed myself when I had not discovered another suitable option. It has less features, but it does the main things - capture JS errors, and allow you to run commands to inspect variables and object on your page.

Here's a demo:

It's activated by just placing this script tag on your page:

<script src="https://cdn.jsdelivr.net/gh/SimonEast/MiniConsoleJS@main/console.js"></script>

Open source, GPL licence. Available at: https://github.com/SimonEast/MiniConsoleJS/

3. vConsole

Another similar option that I've not really tried. Available at https://www.npmjs.com/package/vconsole with a live demo at http://wechatfe.github.io/vconsole/demo.html.

Disunite answered 23/12, 2022 at 13:42 Comment(0)
A
-1

I haven't tried this on a PC, but you should be able to go to http://[DEVICE_IP_ADDRESS]:9999 to debug.

Anlage answered 5/12, 2013 at 18:51 Comment(7)
I can't get this to work. Can you point me to instructions/documentation regarding this?Pancho
I find it very hard to believe this will work. why port 9999? doesn't even make senseMonied
You don't need this anymore. You can use the develop menu item. This was the official way to do this 5 years ago.Anlage
@StephenJohnson What Develop menu and where?Thremmatology
@CsabaToth In Safari you need to open the Safari preferences, go to Advanced, and then toggle on "Show Develop menu in menu bar".Anlage
@StephenJohnson I think you are talking about OSX Safari and not iOS Safari. Is "Show Develop menu in menu bar" available on iPad Safari preferences somewhere? I cannot find it.Thremmatology
As far as I know it is not available in iPad Safari.Anlage

© 2022 - 2024 — McMap. All rights reserved.