1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Google extension popup doesn't appear using OnClick

Discussion in 'HTML & JavaScript' started by ShOwA, May 18, 2013.

  1. ShOwA

    ShOwA Regular Member

    Joined:
    Feb 7, 2010
    Messages:
    300
    Likes Received:
    69
    Here is my site source code:
    HTML:
    <!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>
    So, basically, when you click on the image, it should appear a popup with my chrome extension and, after installing it, you should be redirected to http://mysite.com/page2.Unfortunately it doesn't happen. When you click on the image it only shows the alert "Please add to chrome to enable"..What's wrong with my code?