0

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 ?

aspirinemaga
  • 3,753
  • 10
  • 52
  • 95

1 Answers1

2

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)

Community
  • 1
  • 1
karthick
  • 11,998
  • 6
  • 56
  • 88
  • Oh man thank you. By deactivating the SOURCE MAP option in google chrome's web dev tool problem's gone. Will read more about this new feature. Thanks again – aspirinemaga Oct 05 '13 at 16:49