我正在尝试使用Twitter Web Intents将自定义推文功能添加到我的页面。这是一个复杂的页面,它有很多查询参数,并且超过了140个字符。网址没有缩短。Twitter网络意图URL缩短器
这是我使用的功能:我安慰了URL字符串
function tweet(image){
var pageURL = createPreloadURL(image)
var width = 575,
height = 400,
left = ($(window).width() - width)/2,
top = ($(window).height() - height)/2,
url = 'https://twitter.com/intent/tweet?url='+ encodeURIComponent(pageURL),
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
window.open(url, 'twitter', opts);
}
,它似乎是正确的格式:
http%3A%2F%2Fexample.com%2Fpreload.cfm%3Fproduct_id%3D4420%26year%3D2014%26make_id%3D58%26model_id%3D21604%26diameter%3D17....
在文档here,它的说:
一个完全合格的URL与HTTP或HTTPS计划,URL编码。 提供的URL将会被Twitter的t.co缩短为由short_url_length指定的 个字符的数量。
示例值:HTTP:%3A%2F%2Fexample.com%2F
我看着在控制台的新窗口中我得到这个错误
拒绝执行内联脚本,因为它违反了以下内容 内容安全策略指令:“script-src'unsafe-inline' 'nonce -PfLsh9SlUoh7UKtdZ7mgcA ==''unsafe-eval'https:”。请注意, '不安全内联'会被忽略,如果源列表中存在散列值或随机数 。
是否有额外的步骤,我需要采取使网址缩短工作?