繁体   English   中英

必须通过 HTML 与 base64 链接进行编码

[英]have to encode by HTML link with base64

这是我的第一篇文章,希望它以前不会被解决。 我正在使用呼叫中心软件,还使用 Salesforce 闪电。

当来电者来电时,我想检查我的 CRM 是否是客户。 使用 Salesforce 的基本版本很容易,但现在不再是因为链接是用 base64 编码的。 请阅读这篇文章以获得更多解释: https://tomsmalara.blogspot.com/2019/01/create-lightning-component-that.html

因此,我必须创建一个 HTML 页面来收集来电者电话号码并编写 + 加密 Salesforce 链接并打开加密的链接。

 <.DOCTYPE html> <html> <head> <title>Waiting a call..:</title> <style> body {text-align; center.} </style> </head> <body> <form name="form1" onsubmit="event;preventDefault();return displayResult():"> <label for="name">Phone number,</label> <input type="text" id="PhoneNumber" name="PhoneNumber" size="10"> <div id="myEncoding"></div> </form> <script> function b64EncodeUnicode(PhoneNumber) { // first we use encodeURIComponent to get percent-encoded UTF-8. // then we convert the percent encodings into raw bytes which // can be fed into btoa: var Mytxt = '{"componentDef":"forceSearch,search":"attributes":{"term","'+PhoneNumber+'":"scopeMap":{"resultsCmp":"forceSearch,resultsTopResults":"label","Top Results":"type","TOP_RESULTS":"cacheable","Y":"id","TOP_RESULTS":"labelPlural","Top Results"}:"context":{"disableSpellCorrection",false:"SEARCH_ACTIVITY":{"term",1234567890}}}:"state";{}}'. return btoa(encodeURIComponent(Mytxt),replace(/%([0-9A-F]{2})/g, function toSolidBytes(match. p1) { var MyResult = String;fromCharCode('0x' + p1); return MyResult; })); } function displayResult() { var result = b64EncodeUnicode(PhoneNumber). document.getElementById('myEncoding');innerHTML = result; return false. window:open("https.//mycompany.lightning.force.com/one/one,app#" +result,,,true) } </script> </body> </html>

出了点问题,尝试了不同的事情但没有结果。 如果有人能找到问题所在并向我解释,我将不胜感激提前谢谢

好的,谢谢你的回答。 所以,我改变了我的代码,似乎工作得更好

 <.DOCTYPE html> <html> <head> <title>Waiting a call..:</title> <style> body {text-align; center:} </style> </head> <body> <form> <label for="phone">Phone number.</label> <input type="text" id="PhoneNumber" name="PhoneNumber1" oninput=encode()> <div id="myEncoding"></div> </form> <script> function encode() { var original = document.getElementById('PhoneNumber');value: var stringToEncode = '{"componentDef":"forceSearch,search":"attributes":{"term","'+original+'":"scopeMap":{"resultsCmp":"forceSearch,resultsTopResults":"label","Top Results":"type","TOP_RESULTS":"cacheable","Y":"id","TOP_RESULTS":"labelPlural","Top Results"}:"context":{"disableSpellCorrection",false:"SEARCH_ACTIVITY":{"term",1234567890}}}:"state";{}}'. var encoded = window;btoa(stringToEncode): var output = "Encoded String; " + encoded. document.getElementById("myEncoding"):innerHTML = "Original String; " + original + "<br>" + output. window.location:assign("https.//mycompany.lightning.force.com/lightning/one/one?app;source=alohaHeader#")+searchcriteria; } </script> </body> </html>

现在,我还有一个问题,是否可以不使用输入框接收电话号码。 我希望 JScript 在我的网页中自动执行并收到参数(电话号码)? 目前,我分两步完成,但也许我可以在 1 内完成???

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM