3

I'm following this Site which is a easy way to add a customised tweet box and button on my site and will help in update of post.

As per its functionality, once we write any messages in the textbox and click on tweet button we will get the twitter login pop up window, once we are authenticated our message will be posted on our twitter account wall.

But when i run this code, i'm getting the pop up window and once i provide my credentials the window closes but no message is posted in the twitter account. When i checked on my javascript console im getting error:

Unsafe JavaScript attempt to access frame with https://api.twitter.com/xd_receiver.html from frame with URL about:blank. The frame requesting access has a protocol of 'http', the frame being accessed has a protocol of 'https'. Protocols must match.

I dont know what this error means as my site through which im running the form is clorderdev2.uvacha.com

Below is my code :

 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script type="text/javascript" src="http://platform.twitter.com/anywhere.js?id=YOURCONSUMERKEY&v=1"></script>
   <script type="text/javascript" src="Scripts/jquery.jtweetsanywhere-1.3.1.min.js"></script>
    <script type="text/javascript" src="Scripts/jtweetsanywhere-de-1.3.1.min.js"></script>

<div id="jTweetsAnywhereSample"></div>
<script type="text/javascript">
$('#jTweetsAnywhereSample').jTweetsAnywhere({
showTweetBox:{
    counter: true,
    width: 380,
    height: 65,
    label: '<span style="color: #A4A4A4">What\'s happening?</span>',
    defaultContent: '#jTweetsAnywhere',
    onTweet: function(textTweet, htmlTweet){
        alert('You tweeted: ' + textTweet);
    }
}
});</script>
4

2 回答 2

3

有一个更好的插件来获取Twitter推文,它被称为livetwitter. 您需要的所有信息都在这里:

https://github.com/elektronaut/jquery.livetwitter

于 2012-11-20T11:08:01.630 回答
1

问题是某个脚本试图在 http:// 和 https:// 协议之间进行通信。出于安全原因,JavaScript 不能这样做。这很可能是您正在使用的某个库中的错误。

我建议使用官方 twitter implementation,如果这是一个可能的选择。

于 2012-11-20T10:41:45.757 回答