2013-03-20 51 views
2
發送郵件

我有一個標準的Windows 8的Javascript Store應用下面的代碼:從WinJS

var test = document.getElementById("testButton"); 
test.addEventListener("click", function() { 
var mailto = new Windows.Foundation.Uri("mailto:[email protected]" + "&subject=test" + "&body=Hello,<br>How are you?"); 
Windows.System.Launcher.launchUriAsync(mailto); 

我的問題是,無論我做什麼,我不能得到之間的回車Hello,How are you?。我試過\n & \r\n。我需要插入什麼才能獲得回車?

回答

6

因爲它是一個網址,你必須使用URL編碼的字符:

var mailto = new Windows.Foundation.Uri("mailto:[email protected]" + "&subject=test" + "&body=Hello,%0dHow are you?");