[英]Firefox and Chrome not loading a script from a coldfusion include?
我繼承了一些通常工作正常的冷卻代碼。
我遇到的問題是在一個有cfinclude的頁面上,拒絕加載一個特定的腳本。 如果沒有將腳本加載到它之前的行,它幾乎不會打擾我,但它確實如此。
Firefox甚至沒有嘗試獲取腳本(就像fiddler所見),並且chrome也無法獲得它(除非你在打開chrome時打開該頁面,在這種情況下它會一直運行直到你刷新頁面) 。 然而,Internet Explorer在這方面做得很好並加載它就好了!
你可以在這里看到實況頁面。 右側的頂部“廣告”應該每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 – </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完全阻止它工作(不管它只是分支中的事件)。 我將嘗試重命名腳本。
哦,伙計,我簡直不敢相信。 昨天我花了很多時間試圖解決這個問題。
未來警告:除非它實際上是廣告,否則不要調用你的腳本.*ad.*
任何東西,因為ABP會看到它並在視線中銷毀它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.