【问题标题】:Is it possible to use a "mailto" button in a native iOS HTML page?是否可以在原生 iOS HTML 页面中使用“mailto”按钮?
【发布时间】:2011-10-07 00:12:53
【问题描述】:

我有一个显示一些硬编码 HTML 页面的 IOS 应用程序...是否可以使用 MailTo 按钮打开电子邮件程序?

【问题讨论】:

  • 我相信任何与 mailto: 协议的链接都会打开邮件应用程序。当然你可以试试这个。
  • 是的 .. 试过了,但它不工作......我想知道我是否需要在 iOS 中做一些特定的事情才能让它工作......

标签: html ios xcode


【解决方案1】:

是的,您可以使用有效的mailto: HTML 链接。它很可能无法在 iOS 模拟器 上运行。在您的设备上试用。

【讨论】:

    【解决方案2】:

    我刚刚使用下面的代码进行了尝试,并且链接在那里,但是当我单击链接时,电子邮件应用程序没有加载。事实上什么也没发生。但是,这是在模拟器上。

    更新:这确实在实际设备上打开了邮件应用程序。所以,是的,它确实有效!

    - (void)embedYouTubeWithVideoID:(NSString *)videoID {
        CGFloat w = webView.frame.size.width;
        CGFloat h = webView.frame.size.height;
        NSString *ytUrlString = [NSString stringWithFormat:@"http://www.youtube.com/v/%@&version=3&autohide=1&autoplay=1&cc_load_policy=1&fs=1&hd=1&modestbranding=1&rel=0&showsearch=0", videoID];
        NSString *embed = [NSString stringWithFormat:@"\
                           <html>\
                               <head>\
                                   <meta name=\"viewport\" content=\"initial-scale = 1.0, user-scalable = no, width = %0.0f\"/>\
                               </head>\
                               <body style=\"background:transparent;margin-top:0px;margin-left:0px\">\
                                   <div>\
                                       <object width=\"%0.0f\" height=\"%0.0f\">\
                                           <param name=\"movie\" value=\"%@\" />\
                                           <param name=\"wmode\" value=\"transparent\" />\
                                           <param name=\"allowFullScreen\" value=\"true\" />\
                                           <param name=\"quality\" value=\"high\" />\
                                           <embed src=\"%@\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" wmode=\"transparent\" width=\"%0.0f\" height=\"%0.0f\" />\
                                       </object>\
                                   </div>\
                           <a href=\"mailto:test@example.com\">MAIL_TO_TEST</a>\
                               </body>\
                           </html>", w, w, h, ytUrlString, ytUrlString, w, h];
        [webView loadHTMLString:embed baseURL:nil];
    }
    

    【讨论】:

      猜你喜欢
      • 2019-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-02
      • 2014-06-24
      • 2011-06-03
      • 2015-08-24
      相关资源
      最近更新 更多