如何跟踪javascript文件请求的来源

时间:2013-11-18 23:39:46

标签: javascript jquery joomla zurb-foundation

好吧,我的自定义模板有很多问题,它甚至都不好笑......

这是joomla 3.x的自定义模板......

我想弄清楚的一个问题是缺少的javascript请求来自哪里?

我已经取消发布所有模块,甚至上传了一个带有一些改动的新模板......

但它仍然存在!

如果您查看源并点击所谓的丢失文件,它会显示正常...所以,为什么在Chrome的javascript控制台中它会一直说它是404 !!!!!

您如何计算请求的来源?

另外,我一直在视野中看到这个,但不知道它来自哪里......

<script type="text/javascript">
    window.addEvent('load', function() {
new JCaption('img.caption');
   });
  </script>

编辑......

清楚说明我正在谈论的文件,就是这个:

<script src="/social/services/templates/testingdifferentversion16/js/jquery-1.10.1.min.map.js" type="text/javascript"></script>

如果查看视图源,可以正常访问它。

如果你看到它无法找到它的错误,那么404,文件确实丢失了。

这就是为什么写这篇文章的原因,以便找到该请求来自的

希望这个编辑可以清除一些东西。

编辑2(根据morantis的要求)

##
# @package      Joomla
# @copyright    Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
# @license      GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
##

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

# RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
# 
## End - Joomla! core SEF Section.

2 个答案:

答案 0 :(得分:0)

检查根目录中是否有.htaccess文件,然后检查该文件中是否存在mod_rewrite规则。许多CMS软件包使用mod_rewrite来处理网站导航。如果您使用Filezilla for FTP等程序,请确保该程序在选项中设置了“显示隐藏文件”,否则您甚至可能看不到.htaccess文件。如果有,请在你的问题中发布其内容。

我很快就看了,是的,Joomla确实使用mod_rewrite来控制网站中的流量,并且有多个错误来自此。

http://forum.joomla.org/viewtopic.php?f=304&t=346374

这是一个与您的问题不完全相同的链接,但它确实让您了解如何使用.htaccess搞砸事情。给我一些信息,我们将从那里开始。

好的,如果您尝试访问此file,则必须将其直接放在地址栏中。如果你看一下mod_rewrite规则,你会看到如果URL以“/”结尾或者没有以扩展名结尾,那么它将在其末尾添加“index.php”。

这有意义吗?

答案 1 :(得分:0)

@ user2730725这让我疯了一会儿!该文件是.map,仅用于调试目的。通过打开Chrome开发工具,然后打开设置,关闭尝试检索它的设置,在常规中有一个启用JS源地图的复选框。取消选择它。问题解决了。 :)