ColorBox iframe - 在服务器上找不到请求的url / undefined

时间:2012-01-28 17:05:42

标签: php javascript jquery iframe colorbox

我一直在尝试将最新的ColorBox jquery插件添加到我正在构建的网站中,每次我尝试在ifrae弹出窗口中加载网址时,我都会在iframe中显示以下消息(框架本身生成完美 - 它只是不能sem拉入内容):

>Not Found
>
>The requested URL /myfolder/undefined was not found on this server.

我尝试过在本地找到的链接(例如info_page.php)和外部链接(例如http://www.google.com)。我无法弄清楚为什么它没有加载,因为我的代码几乎直接从colorBox示例中解除。

我的html(头脑中)是:

    <!--COLORBOX-->

    <link rel="stylesheet" href="css/colorbox.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
    <script src="javascript/jquery.colorbox.js"></script>
    <script>
        $(document).ready(function(){
            //Examples of how to assign the ColorBox event to elements
            $(".group1").colorbox({rel:'group1'});
            $(".group2").colorbox({rel:'group2', transition:"fade"});
            $(".group3").colorbox({rel:'group3', transition:"none", width:"75%",     height:"75%"});
            $(".group4").colorbox({rel:'group4', slideshow:true});
            $(".ajax").colorbox();
            $(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
            $(".iframe").colorbox({iframe:true, 'href' : $(this).attr('href'), width:"80%", height:"80%"});
            $(".inline").colorbox({inline:true, width:"50%"});
            $(".callbacks").colorbox({
                onOpen:function(){ alert('onOpen: colorbox is about to open'); },
                onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
                onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
                onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
                onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
            });

            //Example of preserving a JavaScript event for inline calls.
            $("#click").click(function(){ 
                $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
                return false;
            });
        });
    </script>

    <!--END COLORBOX-->

我用来生成这个的正文链接是:

    <a class="iframe" href="http://google.com/">Test</a>

javascript文件和css文件我没有改变在colorBox网站上找到的。任何帮助将不胜感激 - 如果需要更多信息,请告诉我。

(注意:我目前正在本地运营该网站)
http://jacklmoore.com/colorbox/

1 个答案:

答案 0 :(得分:0)

您使用的浏览器是什么?

ColorBox使用ajax动态加载内容,许多浏览器阻止该操作作为安全策略的实现。在当地发展有时会无意中导致被禁止的案件。

需要考虑的事项:

您是否在所有浏览器中都看到此行为? 你能在真正的远程服务器上安装项目吗?

PS。对不起,这不是真正意义上的“答案”......