gpt4 book ai didi

javascript - Firefox 和 Chrome 不从 coldfusion 加载脚本包括?

转载 作者:行者123 更新时间:2023-11-30 10:27:46 25 4
gpt4 key购买 nike

我继承了一些通常运行良好的冷融合代码。

我遇到的问题是在一个包含拒绝加载特定脚本的 cfinclude 的页面上。如果它没有在它之前的行加载脚本,我几乎不会感到困扰,但它确实如此。

Firefox 甚至不会尝试获取脚本(就 fiddler 而言),而 chrome 也无法获取它(除非您在打开 chrome 时打开了该页面,在这种情况下它会一直工作直到您刷新这一页)。然而,Internet Explorer 在这方面做得很好并且加载它也很好!

可以看到直播页面here .右侧顶部的“广告”应该每 4 秒淡出并淡入一个新广告。

这是调用脚本 (adrotator.js) 的地方。 jQuery.js 加载正常,我放入的 alert 也工作正常(在未加载的脚本之上或之下):

<cfsilent>
<!--- THIS IS THE LIST OF LARGE ADS FOR IN THE LARGE AD ROTATOR --->
<cfinclude template="ads/adlist_inc.cfm">
<!--- PUT IN THE NUMBER OF LARGE ADS HERE --->
<cfset adListLarge = GetNumAds("large", 0)> <!--- 0 means all the ads --->
</cfsilent>
<script language="javascript" type="text/javascript" src="/locations/js/jquery.js"></script>
<script type="text/javascript">
alert("test!") <!--- WHY DOES THIS WORK --->
</script>
<!--- WHEN THIS DOESN'T WORK? --->
<script language="javascript" type="text/javascript" src="/locations/js/adrotator.js"></script>

<div id="spotlight_ad_top">
<cfoutput><cfset temp = MakeAllAdImgTags(adListLarge)>#temp#</cfoutput>
</div>

这个页面被这样调用:

<!-- TOP SPOTLIGHT GRAPHICS IN RIGHT COLUMN -->
<div id="locations-branchleaf-spotlight">
<!--- THIS PULLS THE LOCATION SPECIFIC AD IMAGE IF THERE IS ONE --->
<cfoutput query="ReturnLocationInfo">
<cfinclude template="../#initials#/spotlightcontent_inc.cfm">
</cfoutput>
<!-- THIS DISPLAYS THE LOCATION-WIDE PROMOTIONAL SPOTLIGHT -->
<cfinclude template="/locations/includes/spotlightcontent_inc.cfm">
</div>

依次调用它:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--- THIS IS THE INCLUDED PAGE FOR EACH LOCATION'S HOME PAGE INDEX.CFM --->
<cfset PAGE_TITLE = ReturnLocationInfo.name & " - Carnegie Library of Pittsburgh">
<title><cfoutput>#PAGE_TITLE#</cfoutput></title>
<cfinclude template="/includes/header-locations-branchleaf_inc.html">
<cfinclude template="../breadcrumb_inc.html">

<div id="content">
<!-- THIS BRANCH/DEPARTMENT'S NAME, DUMP THE DASH IF IT IS THE pop-up -->
<h1><cfif locationID is 92><cfelse>CLP &ndash; </cfif><cfoutput>#ReturnLocationInfo.name#</cfoutput></h1>
<!-- BRANCH LEAF - LEFT COLUMN: LOCATION PHOTO & CONTACT INFO, HOURS EVENTS, LINKS -->
<div id="leftcolumn">
<!-- 1: LOCATION'S PHOTO/CONTACT INFO WITH LINKSTO DIRECTIONS AND CONTACT FORM -->
<cfinclude template="information_inc.cfm">

<!-- 2: LOCATION'S EMERGENCY NOTICE PULLED FROM TAB MGR NOTICES (SPOTLIGHTS) -->
<cfinclude template="notice_inc.cfm">

<!-- 3: LOCATION'S HOURS GRID -->
<cfinclude template="hours_inc.cfm">

<!-- Testing out location specific notifications! -->
<cfinclude template="notification_inc.cfm">

<!-- 4: LOCATION'S EVENTS -->
<!--- IF THIS IS THE PCCENTER (13) OR JCEC (6), INCLUDE THE programs_inc.cfm IN /locations/pccenter/ --->
<cfif locationID IS 13 or locationID IS 6>
<cfinclude template="/locations/pccenter/programs_inc.cfm">
<cfelse>
<cfinclude template="programs_inc.cfm">
</cfif>

<!-- 5: LINKS FOR LOCATION -->
<cfinclude template="links_inc.cfm">

<!-- 6: STAFF PICK FOR LOCATION IF ONE EXISTS-->
<cfinclude template="staffpick_inc.cfm">
</div> <!--//end leftcolumn -->

<!-- BRANCH LEAF - RIGHT COLUMN: SPOTLIGHT, FLICKR PHOTO GALLERY -->
<div id="rightcolumn">
<!--- LOCATION'S UNUSED MAP AND DIRECTIONS
<cfinclude template="directions_inc.cfm"> --->
<!-- 9. THE SPOTLIGHT AD - FORMERLY TOPAD -->
<cfinclude template="spotlight_inc.cfm">

<!-- 10: PHOTOS TAGGED WITH THIS BRANCH IN FLICKR -->
<cfinclude template="gallery_inc.cfm">
</div> <!--//end rightcolumn -->
</div> <!--//end content -->
<cfinclude template="/includes/footer_inc.html">

有什么我遗漏的,为什么它不会加载脚本?如果我在新选项卡中加载脚本,它会正常连接并显示。

这是脚本:

var activeAdNum = 0;
var totAds = 0;
var adSpeed = 4*1000;
var userBusy = false;

rotate_ads = function() {
if (userBusy){
window.setTimeout(rotate_ads, adSpeed);
return;
}
jQuery(function(){
nextAdNum = (activeAdNum % totAds) + 1;
$("#rotating_ad_"+activeAdNum).fadeOut(500, function(){
$("#rotating_ad_"+activeAdNum).removeClass("rotating_ad_active").addClass("rotating_ad_inactive");
$("#rotating_ad_"+nextAdNum).fadeIn("slow", function(){
$("#rotating_ad_"+nextAdNum).removeClass("rotating_ad_inactive").addClass("rotating_ad_active");
activeAdNum = nextAdNum;
});
});
});
window.setTimeout(rotate_ads, adSpeed);
}

jQuery().ready(function() {
$(".rotating_ad").hover(
function(){
userBusy = true;
},
function(){
userBusy = false;
}
);
var adCount = 0;
$(".rotating_ad").each(function(){adCount++;});
totAds = adCount;
if (totAds > 0){
activeAdNum = 1;
}

window.setTimeout(rotate_ads, adSpeed);
});

最佳答案

天哪,我觉得自己很蠢。

因为它里面有“ad”这个词,adblock plus 完全阻止了它的工作(不管它只是分支上的事件)。我将尝试重命名脚本。

哦,伙计,我简直不敢相信这是那么容易。我花了昨天的大部分时间试图解决这个问题。

future 警告:除非它实际上是广告,否则不要将您的脚本称为 .*ad.* 任何东西,因为 ABP 会看到它并立即销毁它。

关于javascript - Firefox 和 Chrome 不从 coldfusion 加载脚本包括?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18787618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com