我正在写一个do javascript在Safari 中执行的程序.唯一的问题是我试图让应用程序自己允许这样做.我正在尝试找到处理Safari开发人员首选项的文件,以便我可以执行此操作.有没有人知道这可能是什么或如何更改这些设置?
我有以下代码,它应该只获取所有活动接口的 IPv4 地址,但它仍然在某些计算机上返回 IPv6 地址。
public static List<List> getIpAddress() {
List<String> ip = new ArrayList<>();
List<List> ipRefined = new ArrayList<>();
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
if (iface.isLoopback() || !iface.isUp())
continue;
Enumeration<InetAddress> addresses = iface.getInetAddresses();
while(addresses.hasMoreElements()) {
ip.add(addresses.nextElement().getHostAddress());
}
}
} catch (SocketException e) {
throw new RuntimeException(e);
}
for(int x = 0; x < ip.size(); x++){
if(ip.get(x).contains("%")){
try {
if (ip.get(x + 1).contains(".")) {
List<String> tempList = new ArrayList<>();
tempList.add(ip.get(x).substring(ip.get(x).indexOf("%") + 1)); …Run Code Online (Sandbox Code Playgroud)