在 JavaScript mailto url 中的等号在 Android 上被解析

Equal sign in javascript mailto url getting parsed on Android

本文关键字:Android JavaScript mailto url      更新时间:2023-09-26

我有一个网络应用程序,可以从按钮onclick="email();"在电子邮件正文中发送URL链接。 该网址是一个带有.php?id=的 php 页面,等号后的所有内容在从 Android 设备发送时都会被截断。我尝试对 URL 进行编码,但没有任何效果...我知道 mailto 标签使用 = 符号作为解析字符......但仍然无法弄清楚这一点。

这是代码。

  function email() {
  window.location.href = "mailto:?subject=LIVE link!&body=Here is a link for a LIVE demo!%0D%0Awww.domain.ca/scores/" + sport + "php%3Fid%3d" + id   +"%0D%0A%0D%0AThanks";
  }

在这方面有什么建议或经验吗?在所有其他平台(iOS,Windows等)上运行良好

事实证明,它是特定于Android设备上的Outlook应用程序。

这是

来自我的一个网站。

     <?php
    if(!isset($_POST['submit']))
{
//This page should not be accessed directly. Need to submit the form.
echo "error; you need to submit the form!";
 }
$name = $_POST['name'];
$visitor_email = $_POST['mail'];
$message = $_POST['appointment'];
//Validate first
if(empty($name)||empty($visitor_email)) 
{
echo "Name and email are mandatory!";
exit;
}
if(IsInjected($visitor_email))
{
echo "Bad email value!";
exit;
}
$email_from = 'Client';//<== update the email address
$email_subject = "Booking an appointment";
$email_body = "You have received a new message from the user $name.'n"."Here 
is the message:'n $message";
$to = "somebody@hotmail.com ";//<== update the email address
$headers = "From: $email_from 'r'n";
$headers .= "Reply-To: $visitor_email 'r'n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: aboutUs.html');

// Function to validate against any email injection attempts
function IsInjected($str)
{
  $injections = array('('n+)',
          '('r+)',
          '('t+)',
          '(%0A+)',
          '(%0D+)',
          '(%08+)',
          '(%09+)'
          );
  $inject = join('|', $injections);
  $inject = "/$inject/i";
  if(preg_match($inject,$str))
  {
  return true;
  }
  else
  {
   return false;
  }
}
?>