如何在网址中带有#的网页中显示带有Chrome扩展名的弹出式

时间:2019-11-11 11:04:17

标签: javascript google-chrome google-chrome-extension

我正在创建一个Chrome扩展程序,以通过链接在悬停鼠标上显示弹出窗口,它在网站示例中有效:

Https://example/office365_emails_email.com

但是当我转到这样的URL

Https://example/new.html#!/office365_emails_email.com 该扩展名不起作用,我认为是因为#,但我不知道如何解决

var links=document.getElementsByTagName('a');
    for (var i=0;i<links.length;i++)
    {
    links[i].addEventListener('mouseover', readTheLink);
    links[i].addEventListener('mouseout', removePopup);
    }

function removePopup(e) {

popup.style.setProperty("display", "none", "important");

}

    function readTheLink(element) {
    //console.log(this.href)

if (this.href.indexOf('office365_emails_email')>-1)
manifest.json

    "permissions": [
      "activeTab",
      "storage"
    ],
    "background": {
        "scripts": [ "background.js" ]
        },

        "content_scripts": [ {
            "js": [ 
              "jquery-3.4.1.slim.min.js",  
            "code.js"
            ],
            "matches": [ "*://*/*" ],
            "run_at": "document_end"
            }
            ],
            "options_ui": {
              "chrome_style": false,
              "open_in_tab": true,
              "page": "newTabAPI.html"
           },

0 个答案:

没有答案