【问题标题】:Debugging 404 error page loading in Fancybox from script从脚本调试 Fancybox 中的 404 错误页面加载
【发布时间】:2013-10-08 20:44:10
【问题描述】:

目前我不确定如何调试此特定问题。

例如,如果您查看此category page 并点击顶部产品上的“购买”按钮,则会出现一个弹出窗口,点击“继续结帐”按钮,然后会出现一个 Fancybox 模式,短暂显示 404 错误 - 有人会这样吗?请使用他们的浏览器开发工具并指出为什么它会在 Fancybox 模式中加载 404 错误页面?

控制这个的脚本有点乱,但我在下面提供了它以供参考......

<script type="text/javascript">
    jQuery.noConflict();
    jQuery(document).ready(function(){
        jQuery('.fancybox').fancybox(
            {
               hideOnContentClick : true,
               width: 382,
               autoDimensions: true,
               type : 'iframe',
               showTitle: false,
               scrolling: 'no',
               onComplete: function(){
                jQuery('#fancybox-frame').load(function() { // wait for frame to load and then gets it's height
                    jQuery('.fancybox').height(jQuery(this).contents().find('body').height()+30);
                    jQuery.fancybox.resize();
                 });

               }
            }
        );
    });
    function showOptions(id){
        jQuery('#fancybox'+id).trigger('click'); //show the custom options on click if they exist
    }
    function setAjaxData(data,iframe){
        if(data.status == 'ERROR'){
            alert(data.message); //show error message if nothing to update
        }else{
            if(jQuery('.block-cart')){
                jQuery('.block-cart').replaceWith(data.sidebar); //otherwise update the cart in the sidebar block
            }
            if(jQuery('.header .links')){
                jQuery('.header .links').replaceWith(data.toplink); //otherwise update the cart in the header block
            }
            jQuery.fancybox.close();
        }
    }
    function setLocationAjax(url,id){
        url += 'isAjax/1';
        url = url.replace("checkout/cart","ajax/index");
        jQuery('#ajax_loader'+id).show();
        try {
            jQuery.ajax( {
                url : url,
                dataType : 'json',
                success : function(data) {
                    jQuery('#ajax_loader'+id).hide(); //if success, hide #ajax_loader
                    jQuery('.popup-text').html(data.message); //if success, show .popup-text that says product is added to cart
                    jQuery('.fancy-popupbox').show(); //if success, show .fancy-popupbox content
                    //jQuery.fancybox.open('.fancy-popupbox');
                    setAjaxData(data,false);
                }
            });
        } catch (e) {
        }
    }
</script>

如果我能提供更多有关这方面的信息,请告诉我。

【问题讨论】:

  • 你不能使用开发工具吗?
  • 不调试 javascript / jquery no :(
  • 好吧,我为你做了。看我的回答! :)
  • 这是我为你完成的吗?如果还有什么我可以做的,请告诉我...
  • 呃...没有。您只是复制了 Chrome 控制台中显示的内容 - 这根本不是我想要的。

标签: javascript jquery fancybox


【解决方案1】:

Chrome 工具检测到的错误如下:

Uncaught SecurityError: Blocked a frame with origin "http://s3-eu-west-1.amazonaws.com" from accessing a frame with origin "http://www.showermania.co.uk". Protocols, domains, and ports must match.`` Uncaught SecurityError: Blocked a frame with origin "http://static.ak.facebook.com" from accessing a frame with origin "http://www.showermania.co.uk". Protocols, domains, and ports must match.`` Uncaught SecurityError: Blocked a frame with origin "https://s-static.ak.facebook.com" from accessing a frame with origin "http://www.showermania.co.uk". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.`` Uncaught SecurityError: Blocked a frame with origin "http://static.ak.facebook.com" from accessing a frame with origin "http://www.showermania.co.uk". Protocols, domains, and ports must match. chrome-extension://geelfhphabnejjhdalkjhgipohgpdnoc/controllers/frame.js:1 Failed to load resource

基本上,您的端口配置不正确。正如它所说,“协议、域和端口必须匹配。”

【讨论】:

  • 我知道如何查看控制台,我需要帮助来实际调试 jquery。这些错误甚至与问题无关(它们与 chrome 扩展/facebook 脚本相关)。
猜你喜欢
  • 1970-01-01
  • 2013-05-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-03
  • 2012-02-23
  • 2012-08-11
  • 1970-01-01
相关资源
最近更新 更多