chromium - Extensions Issue - ContentScript & Premissions for an overlay -


i'm developing overlay google chrome (a toolbar if prefer), , have issues , can't understand reason why.

so, i've created extension manifest.json :

{         "background_page" : "background.html",     "browser_action" :     {         "default_icon" : "images/extension.png"     },     "content_scripts":      [ {       "all_frames": true,       "css": ["css/overlay.css"],       "js": ["js/overlay.js"],       "matches": ["http://*/*"],       "run_at": "document_start"     } ],      "permissions" : ["tabs", "unlimitedstorage", "http://*/*"],      "name" : "myoverlay",     "version" : "1.1",     "description" : "sindar overlay" } 

the concept background.html page call jquery.js , overlay.js. on initialization of overlay.js call html page (overlay.html) using

<iframe id="yourtoolbarframe" src="'+toolbarurl+'"> 

the problem when i'm trying start extension seem good, no compilation problem don't see overlay. , when i'm opening html page ok, see it. i'm asking myself if problem dont come contentscript or permissions dont know come from...

thanks in advance.

edit 23/02/2011 - 18:46

background.html

<html>   <head>     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>     <script src="js/overlay.js"></script>   </head> </html> 

overlay.js

var overlay= {     init: function() {         this.injectoverlay();         //alert('initialisation reussie');     },      injectoverlay: function() {         var body = $('body'),             overlayurl = chrome.extension.geturl("overlay.html"),             iframe = $('<iframe id="youroverlayframe" src="'+overlayurl+'">');              body.append(iframe);             iframe.show();          //alert('injection reussie');     } }  var length = {}, maxlength = 0, currentlength;  $(function(){ $('#menu li.title')    .each(function(){         // save menu length         length[$(this).attr('id')] = currentlength = $(this).height();          // fix height         $(this).height(20);          if(currentlength > maxlength)         {             maxlength = currentlength;         }          // don't overflow on content         $('#menu').height(maxlength);    })     .mouseenter(function(){         $(this).stop().animate({             height: length[$(this).attr('id')]         }, 500);    })    .mouseleave(function(){        $(this).stop().animate({            height: '20px'        }, 500);          }); });  $(document).ready(function() {     overlay.init(); }); 

overlay.html

<html>   <head>         <title>overlay</title>         <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />         <link rel="stylesheet" href="css/overlay.css" type="text/css"></link>         <base target="_blank" />     </head>     <body>         <div class="default">             <form id="searchform">                 <img id="logo" src="images/extension.png"></img>                 <input type="search" value="enter research" name="search">                 <input type="submit" value="go !" /> |             </form>              <ul id="menu">                 <!--                 <li class="title" id="accueil">                     <a class="" href="#">accueil</a>                 </li>                 -->                 <li class="title" id="contact">                     <a class="" href="#">contact</a>                     <ul class="dropmenu">                         <li><a href="www.google.com">google</a></li>                         <li><a href="www.yahoo.com">yahoo</a></li>                     </ul>                 </li>             </ul>         </div>          <!--    include library of google, more centralized.                 optimized browser cache.                 compressed version. -->          <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>      </body> </html> 

currently include overlay.js content script pages plus include background page reason. don't need background page task. if doing inject jquery solution download jquery.js , put extension folder, automatically inject in manifest.json:

//"background_page" : "background.html", - not needed "content_scripts":      [ {       "all_frames": true,       "css": ["css/overlay.css"],       "js": ["js/jquery.js", "js/overlay.js"], //jquery included       "matches": ["http://*/*"],       "run_at": "document_start"     } ],  

(besides background page doesn't have visible body, inject frame invisible page right now)


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -