在Windows下chrome调试iOS中的safari

分享 未结 1 2186
simpleoo0o
simpleoo0o LV1 2018-07-06
悬赏:20积分
安装前准备:
1、要保证iPhone/iPad能使用USB与电脑正常连接
2、在iOS中打开调试模式:设置->Safari->高级->Web 检查器


安装
1. 安装scoop
# 使用Powershell进行安装
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
# 如果安装失败,请执行以下命令再重新安装
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
2. 安装ios-webkit-debug-proxy
# 在Powershell中执行
scoop bucket add extras
scoop install ios-webkit-debug-proxy


使用
1. 启动ios-webkit-debug-proxy
# 在Powershell中执行,-f表示指定前端工具,这里使用chrome-devtools进行调试
ios_webkit_debug_proxy -f chrome-devtools://devtools/bundled/inspector.html
执行成功后,Powershell窗口会显示
Listing devices on :9221
Connected :9222 to 你的设备名称
2. 打开网页
在chrome浏览器中输入localhost:9221,如果进入网页后出现Inspectable pages for 你设备的名称字样,表示连接成功,然后在iPhone/iPad中使用Safari打开网页,再刷新电脑上的chrome,就会出现一个超链接(chrome-devtools://devtools/bundled/inspector.html?ws=localhost:9222/devtools/page/1),然后右键复制链接地址并在新标签中打开,就可以像在电脑中一样对网页进行调试了。


转自:https://www.jianshu.com/p/73715ee54712
回帖