0

这是我的网站源代码:

<!DOCTYPE html>
<html>

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
        </script>
        <meta name="robots" content="all">
        <meta name="revisit-after" content="2 hours">
        <meta name="distribution" content="global">
        <meta name="viewport" content="width=728">
        <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/MyExtensionId">
        <title>
        </title>
    </head>

    <body bgcolor="#ffffff" background="bg.png" topmargin="0" leftmargin="0">
        <center>
            <a href="#" target="_top" onclick="doWork()" role="button"><img src='f.png'></a>
        </center>

        <script type="text/javascript">
        function doWork() {
    chrome.webstore.install("https://chrome.google.com/webstore/detail/MyExtensionId", function() {
        setTimeout(function() {
            top.location.href = "http://mysite.com/page2";
        }, 777);
    }, function() {
        alert('Please "Add to Chrome" to enable');
    });
    installed = true;

}
        </script>
    </body>

</html>

因此,基本上,当您单击图像时,它应该会出现一个带有我的 chrome 扩展程序的弹出窗口,并且在安装它之后,您应该被重定向到http://mysite.com/page2。不幸的是,它没有发生。当您单击图像时,它仅显示警报“请添加到 chrome 以启用”..我的代码有什么问题?请帮帮我

4

0 回答 0