我有一个带有链接的测试HTML页面:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a href="localhost:8080">Log in with TouchLogin</a>
</body>
</html>
单击时,链接不执行任何操作。如果我添加target = "_blank"
属性,该链接将打开一个新选项卡,但不会加载指定的URL。如果我按住Ctrl键单击它,链接就会正常打开。发生了什么事?
提前致谢。
答案 0 :(得分:1)
很高兴你明白了!
省略http://将始终尝试打开代码所在的本地资源。
例如,如果您正在离线工作......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a href="localhost:8080">Log in with TouchLogin</a>
</body>
</html>
将打开类似 c:// user / parent / localhost:8080
的内容在线工作会打开类似 http://parentsite.com/localhost8080
的内容所以,当链接到您的网站上的网页时,请忽略http://,但在外部链接时请包含。 :)
答案 1 :(得分:0)
在AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
final View dialogView = inflater.inflate(R.layout.custom_dialog, null);
dialogBuilder.setView(dialogView);
Button yes = (Button) dialogView.findViewById(R.id.yes);
yes.onClickListenere(......./do what you want);
(google.com)中使用其他网址时计算出来。没有“http://”它就无法工作,所以我将“http://”添加到localhost链接并且它有效。