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)

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

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?