我在手机上有两个简单的文字功能:
onclick
将用户重定向到指定网址的功能类似的网站是这样的: http://app.mobileoptin.com/c2926/advertlines
在上面的示例中,在移动浏览器中,如果用户点击“Click Here For Access”按钮,它将:
这正是我所需要的。
代码我有:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
function Redirect() {
window.location.href="http://www.google.com";
}
</script>
</head>
<body>
<a href="mailto:test@theearth.com?subject=Circle Around&body=Some blah" name="redirect" onclick="Redirect();">Email</a>
</body>
</html>
它在桌面上运行良好,但由于某些原因我无法在移动设备上运行,至少在Android中。
感谢您的想法,如果有更好的方法,欢迎您的建议。
答案 0 :(得分:0)
/// add here your url link
String url = "http://www.xxxxxxxx.com/apply";
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append("hi friends please visit my website for");
int start = builder.length();
builder.append(url);
int end = builder.length();
builder.setSpan(new URLSpan(url), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"abcd@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email is this");
i.putExtra(Intent.EXTRA_TEXT, builder);
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}