Twitter intent link 无法在页面上运行,但可以通过开发工具运行
Twitter intent link not working on page, but it does work from dev tools
当我点击页面上的 link 时,我收到以下错误:
twitter.com is blocked twitter.com refused to connect ERR_BLOCKED_BY_RESPONSE
我使用以下代码将 link 添加到页面:
function getQuote() {
let newQuote = randomQuote().q;
let newAuthor = randomQuote().a;
let tweetURL = 'https://twitter.com/intent/tweet?hashtags=quotes&text=';
tweetURL = tweetURL + encodeURIComponent(newQuote + ' ' + newAuthor);
$('#text').text(newQuote);
$('#author').text(newAuthor);
$('#tweet-quote').attr('href', tweetURL);
}
如果我在 chrome 中打开开发者工具,我可以点击标签中的 link,它工作得很好。
为什么它在页面上不起作用?
我的 React 代码也有同样的问题。我还将目标属性设置为“_blank”。
阅读下面的 post,将其更改为“_top”,推文按钮开始在我的 chrome 浏览器上工作。
当我点击页面上的 link 时,我收到以下错误: twitter.com is blocked twitter.com refused to connect ERR_BLOCKED_BY_RESPONSE
我使用以下代码将 link 添加到页面:
function getQuote() {
let newQuote = randomQuote().q;
let newAuthor = randomQuote().a;
let tweetURL = 'https://twitter.com/intent/tweet?hashtags=quotes&text=';
tweetURL = tweetURL + encodeURIComponent(newQuote + ' ' + newAuthor);
$('#text').text(newQuote);
$('#author').text(newAuthor);
$('#tweet-quote').attr('href', tweetURL);
}
如果我在 chrome 中打开开发者工具,我可以点击标签中的 link,它工作得很好。
为什么它在页面上不起作用?
我的 React 代码也有同样的问题。我还将目标属性设置为“_blank”。 阅读下面的 post,将其更改为“_top”,推文按钮开始在我的 chrome 浏览器上工作。