dongneng5383 2013-10-05 16:32
浏览 40
已采纳

奇怪的文件格式在控制台中重写错误500

I have a strange problem that i just can't solve. The problem is about javascript file loading. I'am using a CodeIgniter 2.1.x if that helps.

There is a file with configuration located in /app/config/template.php where I load the javascript within the arrays:

$config['head_meta']        = array(
    'charset'       => 'UTF-8',
    'description'   => '',
    'keywords'      => '',
    'stylesheets'   => array(
        'template.css'
    ),
    'scripts'       => array(
        'plugins/jquery-2.0.3.min.js',
        'plugins/bootstrap.min.js'
    ),
    'end_scripts'   => array(
        'template.js'
    )
);

A main template view file app/views/templates/default.php:

...
    <head>
        <?php foreach($this->config->item('stylesheets', 'head_meta') as $stylesheet):?>
            <link rel="stylesheet" href="<?php echo base_url();?>assets/css/<?php echo $stylesheet;?>" type="text/css" />
        <?php endforeach;?>

        <?php foreach($this->config->item('scripts', 'head_meta') as $scripts):?>
            <script src="<?php echo base_url();?>assets/js/<?php echo $scripts;?>" type="text/javascript"></script>
        <?php endforeach;?>
    </head>
    <body id="csspage-<?php echo $this->config->item('page_slug');?>">
        ...
        <?php foreach($this->config->item('end_scripts', 'head_meta') as $end_scripts):?>
            <script src="<?php echo base_url();?>assets/js/<?php echo $end_scripts;?>" type="text/javascript"></script>
        <?php endforeach;?>
    </body>
...

What I always get as an error in Webdeveloper's console (Chrome/Firefox) is this:

GET http://localhost/testweb/web/assets/js/plugins/jquery-2.0.3.min.map 500 (Internal Server Error) 

You can see that there is a file suffix .map instead of .js. Why this happens is my main question.

Can someone tell me what I'am doing wrong here pls ?

  • 写回答

1条回答 默认 最新

  • dongshi1880 2013-10-05 16:44
    关注

    This issue occurs only when you try to use the developer's console. Source Map's are new features that are added in browser's nowadays to ease the debugging process of minified codes.

    You have a minified code and if you have the map file in the proper location then the console loads the original source code instead of minified code when debugging. So the issue will occur only when debugging and not when you see the website normally.

    You can find more answers in this link

    http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

    There is a SO post too

    jQuery's jquery-1.10.2.min.map is triggering a 404 (Not Found)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度