[英]How to save a complete page in Chrome using JavaScript (from Dev Tools)?
[英]Twitter intent link not working on page, but it does work from dev tools
當我點擊頁面上的鏈接時,我收到以下錯誤: twitter.com 被阻止 twitter.com 拒絕連接 ERR_BLOCKED_BY_RESPONSE
我使用以下代碼將鏈接添加到頁面:
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 中打開開發人員工具,我可以點擊標簽中的鏈接,它工作得很好。
為什么它在頁面上不起作用?
我的 React 代碼也有同樣的問題。 我還將目標屬性設置為“_blank”。 閱讀下面的帖子,將其更改為“_top”,推文按鈕開始在我的 chrome 瀏覽器上工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.