Facebook就像按钮没有发布到Facebook(Facebook like button not posting to facebook)
我在这个网站的顶部有一个类似Facebook的按钮: 点击这里
当您单击该按钮时,您成功地喜欢该页面,但“发布到Facebook”功能不起作用。 模态窗口就在那里。
这工作正常,直到我前几天对网站做了一些更改,但即使我删除了这些更改,“post to facebook”问题仍然存在。
我试过调试页面,但无济于事。 我想也许facebook一直在惩罚网站上那么多搞乱类似按钮,但我不确定这是否甚至是facebook的功能。
任何帮助,将不胜感激。 谢谢。
I have a facebook like button at the top of this website: Click here
When you click on the button, you successfully like the page, but the "post to facebook" feature doesn't work. The modal window just stays there.
This worked fine until I made some changes to the site the other day, but even after I removed those changes, the "post to facebook" problem persisted.
I've tried debugging the page, but to no avail. I thought perhaps facebook had been punishing the website for messing with the like button so much, but I'm not sure if that's even something facebook does.
Any help would be appreciated. Thanks.
原文:https://stackoverflow.com/questions/13627690
最满意答案
问题可能是字符编码。 您应该使用JavaScript中的方法
encode_utf8(stringValue)
和.NET中的new UTF8Encoding.getBytes(String value)
,以确保字符编码匹配。 请注意,现代加密基于字节,而不是字符串或字符。 使用System.Buffer.BlockCopy()
来编码字符真的是不好的做法。The problem is probably the character encoding. You should use for instance the method
encode_utf8(stringValue)
in JavaScript andnew UTF8Encoding.getBytes(String value)
in .NET, to make sure that the character encodings match. Note that modern cryptography is based on bytes, not on strings or characters. UsingSystem.Buffer.BlockCopy()
to encode characters is really bad practice.
相关问答
更多-
hash_hmac(PHP)vs hex_hmac_sha1(Javascript)(hash_hmac (PHP) vs hex_hmac_sha1 (Javascript))[2020-11-12]
PHP和JS实现之间的区别在于,PHP将UTF-8字符串作为8位字符处理,而在JS中,每个字符串都由Unicode表示。 请尝试一下: hash_hmac("sha1", 'ą', "1492343027") == hex_hmac_sha1("1492343027",'\xC4\x85') 的jsfiddle UTF 8 hex来自 - http://www.charbase.com/0105-unicode-latin-small-letter-a-with-ogonek JS hex_hmac_sha ... -
你告诉jsSHA库输入是十六进制字符串: var hmacObj = new jsSHA(time, "HEX"); 但是你在hash_hmac()调用之前/之内没有做任何与PHP相同的事情。 这意味着jsSHA获取原始二进制数据,而PHP的hash_hmac()获取文字字符串“0000000002f3e3c9”。 当然,这不会产生相同的结果。 将hex2bin()应用于$time然后将其传递给hash_hmac() 。 You tell that jsSHA library that the input ...
-
python hex hmac md5的密码与javascript不匹配(python hex hmac md5 of passwords not matching javascript)[2023-10-17]
这就是Python的hmac模块的用途,不要直接使用MD5功能。 # Right import hmac # Note that hmac.new defaults to using MD5 hmac.new("password", "message").hexdigest() # 'f37438341e3d22aa11b4b2e838120dcf' # Wrong from hashlib import md5 md5("message"+"password").hexdigest() # 'd0647 ... -
所以你正在消化JavaScript中没有内容的hmac? 那是什么目的? 您通常希望使用hmac进行消息身份验证,但如果您没有消息,则不需要进行身份验证。 你能更具体地说明为什么你试图使用没有内容的hmac? 通常在JS中你会做这样的事情: var crypto = require('crypto'); var myHash = function(seed){ var hash = crypto.createHmac('sha256', seed).update('my message').dige ...
-
您的问题是由您的密钥造成的。 在C#中,您传入一个16字节的数组作为键。 在CryptoJS中,你传入一个CryptoJS正在解释为密码的字符串,因此它将生成一个完全不同的密钥。 编辑 :这是如何在JavaScript中获取正确的密钥: 如果您将16字节密钥转换为Base64,则可以在javascript中执行以下操作。 它将生成一个WordArray作为键,并使用该键生成您的哈希。 var keyBase64 = "eFY0EiMBZ0UBI0VniRI0Vg=="; var key = CryptoJS ...
-
为什么Go生成与PHP和JavaScript不同的hmac哈希?(Why does Go generate hmac hashes different than PHP and JavaScript?)[2023-07-15]
问题是你的PHP和JavaScript代码都这样做: Base64(Hex(Hmac(key, msg))) 。 你真的不需要双重编码。 在PHP中,您可以简单地请求raw_encoding而不是十六进制: $macSum = hash_hmac('sha256', $data, 'secret', true); 并且在CryptoJS中,您必须直接编码到Base64,而不是编码为十六进制,然后使用btoa() : var data64 = mac.toString(CryptoJS.enc.Base64) ... -
您的方法必须按原样返回正确的结果。 请参阅http://oauth.net/core/1.0/#signing_process : HMAC-SHA1签名方法使用[RFC2104]中定义的HMAC-SHA1签名算法,其中签名基本字符串是文本, key是消费者秘密和令牌秘密的连接值(每个参数编码首先编码) ,即使为空,也用'&'字符(ASCII码38)分隔 。 在这种情况下,关键应该是"efgh&mnop" 。 Your method must returns correct result as is. Se ...
-
问题可能是字符编码。 您应该使用JavaScript中的方法encode_utf8(stringValue)和.NET中的new UTF8Encoding.getBytes(String value) ,以确保字符编码匹配。 请注意,现代加密基于字节,而不是字符串或字符。 使用System.Buffer.BlockCopy()来编码字符真的是不好的做法。 The problem is probably the character encoding. You should use for instance t ...
-
使用JavaScript计算HMAC-SHA1签名[复制](Calculate HMAC-SHA1 Signature using JavaScript [duplicate])[2022-03-31]
嗨,我认为这可能对你有所帮助。 在这里你可以找到计算hmac sha1的链接: http://caligatio.github.io/jsSHA/ 在这里,您可以在javascript中找到源代码。 https://github.com/Caligatio/jsSHA/releases/tag/v1.5.0 Hi i think this might be helpful for you. Here you can find out the link to calculate hmac sha1: http ... -
JavaScript现在具有WebRTC,其中两个客户端可以进行对等通信,这将是客户端可以生成和使用自己的“秘密”的情况。 在某些情况下,客户端 - >服务器也可以使用。 如果您的服务器“动态”为JavaScript提供服务,那么它可以根据客户端当前会话/登录信息插入“秘密”。 假设您正在使用HTTPS(如果不是,可能会有一个人在中间扯掉“秘密”)那么假设与该特定“秘密”签署的服务器的通信(即使在不安全的HTTP上)也属于仅仅是不合理的那个客户。 JavaScript now has WebRTC wher ...