第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

從站點(diǎn)下載 Chrome 擴(kuò)展程序,無(wú)需重定向到 Chrome 網(wǎng)上商店頁(yè)面

從站點(diǎn)下載 Chrome 擴(kuò)展程序,無(wú)需重定向到 Chrome 網(wǎng)上商店頁(yè)面

暮色呼如 2021-12-12 17:49:46
我有一個(gè)網(wǎng)站和一個(gè) chrome 擴(kuò)展。我想在現(xiàn)場(chǎng)推廣這個(gè)擴(kuò)展。當(dāng)用戶(hù)看到此促銷(xiāo)時(shí),他可以單擊“下載擴(kuò)展程序”按鈕,目前它會(huì)將用戶(hù)重定向到 Chrome 網(wǎng)上應(yīng)用店。所以,我想實(shí)現(xiàn)下一個(gè)流程:用戶(hù)點(diǎn)擊“下載擴(kuò)展”按鈕擴(kuò)展安裝開(kāi)始,但沒(méi)有重定向到 Webstore。這必須是實(shí)際的 Chrome 網(wǎng)上應(yīng)用店項(xiàng)目,而不是網(wǎng)站上保存的文件。可以向他們顯示來(lái)自 Webstore 或 smth 的警報(bào)。但我真的想在沒(méi)有重定向的情況下做到這一點(diǎn)。謝謝)
查看完整描述

1 回答

?
收到一只叮咚

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超5個(gè)贊

好吧,如果不重定向到 chrome 網(wǎng)上商店,你就無(wú)法做到這一點(diǎn)。當(dāng)然,你也可以直接把CRX文件交給用戶(hù),讓他們親手安裝擴(kuò)展,但這顯然不是用戶(hù)體驗(yàn)的最佳選擇


解決了下一個(gè)解決方案:


安裝擴(kuò)展后立即 - 我創(chuàng)建了一個(gè)帶有我需要的頁(yè)面的選項(xiàng)卡


chrome.runtime.onInstalled.addListener(function() {


  chrome.tabs.create({

    url: 'https://mail.google.com',

    active: true

  });


  return false;

});

還可以查看當(dāng)前打開(kāi)的選項(xiàng)卡并將焦點(diǎn)放在我們需要的選項(xiàng)卡上:


chrome.runtime.onInstalled.addListener(function(details) {

  if ((details.reason === 'install') || (details.reason === 'update')) 

  { 

    refreshBrowser('gmail-inbox', true); 

  } 

}); 


function refreshBrowser(target, bringToForeground) {

  if (target !== 'gmail-inbox') return; 

  chrome.windows.getAll({ populate: true }, function(windows) 

  { 

    var foundExisting = false; 

    windows.forEach(function(win) 

    {

      win.tabs.forEach(function(tab) 

      { 

        // Ignore tabs not matching the target. 

        if (target === 'gmail-inbox') { 

          if (!/https:\/\/(mail|inbox)\.google\.com/.test(tab.url)) return; 

        } 

        else 

        { 

          return; // Unknown target. 

        } 

        // Reload the matching tab.  

        chrome.tabs.reload(tab.id); // If this is the first one found, activate it. 

        if (bringToForeground && !foundExisting) 

        {

          chrome.tabs.update(tab.id, { active: true }); } 

          foundExisting = true; 

        }); 

      }); 

      // If no gmail tab found, just open a new one. 

      if (bringToForeground && !foundExisting) 

      { 

        chrome.tabs.create({ url: (target === 'gmail-inbox') ? 'https://mail.google.com' : 'https://www.mixmax.com', active: true 

      });

    } 

  });

}



查看完整回答
反對(duì) 回復(fù) 2021-12-12
  • 1 回答
  • 0 關(guān)注
  • 218 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)