在Google Chrome扩展程序中单击链接并在扩展程序中插入Flash播放器时打开弹出窗口

时间:2012-12-13 03:13:01

标签: google-chrome google-chrome-extension

你好(是的,很长的头衔)

我正在制作我的第一个谷歌浏览器扩展程序,我遇到了一些麻烦。

有关扩展程序的信息(只是让您了解我正在尝试制作的内容):

扩展程序是一个“Radio”,一个播放来自shoutcast网址的音乐的flash播放器。在Flash播放器的底部,有4个图标,其中3个点击下载.pls文件,用VLC打开 - WinAmp& iTunes和一个应该打开一个弹出窗口,显示以下来自收音机的信息。

我要做的是:

1 - 当用户点击图标时(在下图中的红色方块中),弹出窗口应该打开播放器(Windows媒体播放器)和一些有关收音机的信息(通过IFRAME)

2 - 在扩展程序中显示Flash播放器(以及Windows媒体播放器),这似乎不起作用......

- 图片:http://i.imgur.com/1qZDn.png

代码:

1 - manifest.json:

{
"name": "Kombat Syndicate Radio Extension",
"version": "1.0",
"manifest_version": 2,
"description": "Kombat Syndicate Radio",
"browser_action":   {
    "default_icon": "icon.png",
     "19": "icons/icon.png",  
     "128": "icons/icon_128.png",
    "default_popup": "ksradio.html"
},

   "permissions": [
   "tabs"
    ]

}

2 - ksradio.html:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1><img style="margin-top:-15px;-webkit-box-reflect: below 0px -webkit-   gradient(linear, left top, left bottom, from(transparent), color-stop(87%, transparent),  to(white));
" src="icons/ks_radio_icon.png" /><br />Kombat Syndicate Radio</h1>

<div align="center" text-align="center" id="content">
<div id="smallffmp3">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="140" height="80"   __idm_id__="1284874242">
    <param name="movie" value="http://tracks.kombatsyndicate.com/wp- content/plugins/shout-stream/smallffmp3.swf?url=http://85.25.118.16:7502/;&amp;title=Trac[kS]">
    <param name="wmode" value="transparent">
    <param name="allowscriptaccess" value="sameDomain"><!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="http://tracks.kombatsyndicate.com/wp-content/plugins/shout-stream/smallffmp3.swf?url=http://85.25.118.16:7502/;&amp;title=Trac[kS]" width="140" height="80" __idm_id__="1284874243">
    <param name="wmode" value="transparent">
    <param name="allowscriptaccess" value="sameDomain"><!--<![endif]-->
    </object><!--<![endif]-->
     </object>

     </div>

    <a href="http://85.25.118.16:7502/listen.pls" target="_blank"><img  src="icons/VLC_48.png" title="VLC Media Player"/></a>
    <a href="#" onClick="ksradiowmp()"><img src="icons/WMP_48.png" /></a>
    <a href="http://85.25.118.16:7502/listen.pls" target="_blank"><img  src="icons/WinAmp_48.png" title="WinAmp Media Player" /></a>
    <a href="http://85.25.118.16:7502/listen.pls" target="_blank"><img  src="icons/iTunes_48.png" title="iTunes" /></a>

    <iframe align="middle" style="display:block;" name="infos"  src="http://phpks.comoj.com/radioinfos.php" width="65%" height="70%" frameborder="0"   scrolling="no" seamless></iframe>

    </div>

    </body>
    </html>

3 - ksradio_wmp.html(弹出窗口):

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<h1><img style="margin-top:-15px;-webkit-box-reflect: below 0px -webkit- gradient(linear, left top, left bottom, from(transparent), color-stop(87%, transparent),  to(white));
" src="icons/ks_radio_icon.png" /><br />Kombat Syndicate Radio</h1>
<div style="overflow:hidden;" align="center" id="content">
<object id="MediaPlayer1" width="350" height="65" classid="clsid:6bf52a52-394a-11d3- b153-00c04f79faa6"  codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1 ,52,701">
<param name="FileName" value="http://85.25.118.16:7502/" />
<param name="animationatStart" value="true" />
<param name="transparentatStart" value="true" />
<param name="autoStart" value="true" />
<param name="showControls" value="true" />
<param name="fullScreen" value="false" />
<param name="url" value="http://85.25.118.16:7502/" />
<param name="pluginspage" value="http://www.microsoft.com/Windows/MediaPlayer/" />
<param name="autostart" value="1" />
<param name="showcontrols" value="1" />
<embed id="MediaPlayer1" width="350" height="65" type="application/x-mplayer2"   src="http://85.25.118.16:7502/" FileName="http://85.25.118.16:7502/"  animationatStart="true" transparentatStart="true" autoStart="true" showControls="true"  fullScreen="false" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"  autostart="1" showcontrols="1" />
   </object>
   <a href="http://85.25.118.16:7502/listen.pls"><img src="icons/VLC_48.png" title="VLC   Media Player"/></a>
   <a href="http://85.25.118.16:7502/listen.pls"><img src="icons/WinAmp_48.png" title="WinAmp Media Player" /></a>
   <a href="http://85.25.118.16:7502/listen.pls"><img src="icons/iTunes_48.png"   title="iTunes" /></a>
   <iframe style="display:block;" name="infos"   src="http://phpks.comoj.com/radioinfos.php" width="65%" height="70%" frameborder="0"   scrolling="no" seamless></iframe>

   </div>
   </body>
   </html>

4 - script.js:

function ksradiowmp() {
window.open("ksradio_wmp.html", "myWindow", "status=1, height=450, width=400, resizable=0, toolbar=no, directories=no, menubar=no, scrollbars=no")

}

P.S:这就是弹出窗口的样子:http://i.imgur.com/SwzNW.png

所以要恢复,我需要帮助从扩展程序打开弹出窗口,并在扩展程序中显示Flash播放器和Windows Media Player。 我真的希望你们能帮忙:D 提前谢谢。

1 个答案:

答案 0 :(得分:0)

消除

的所有实例

a)value="http://tracks.kombatsyndicate.com/wp- content/plugins/shout-stream/smallffmp3.swf?url=http://85.25.118.16:7502/;&amp;title=Trac[kS]"

b)href="http://85.25.118.16:7502/listen.pls"

c)onClick="ksradiowmp()"等等

有关详细信息,请参阅此Basic message passing in chrome extension seems to fail

如果您需要更多信息,请与我们联系。