XP SP2 breaks body onload or location.href?

  • Thread starter Thread starter crwng
  • Start date Start date
C

crwng

Hi. I'm trying to forward my web site users to a more friendly error
message whenever they encounter a 404 page not found error.

So far, it's been working fine...until XP SP2 came onto the scene.
I've so far refused to update to SP2 so I've been unaware of the issue
until someone just pointed it out to me.

The code below fails to forward to the URL I'm passing to it. Did SP2
disable the ability to use <body onload= or to use location.href?

<html>
<head>

<cfparam name="variables.baseURL" default="http://www.mycompany.com">

<script language="javascript1.2">
function forward(url){
var baseURL = '<cfoutput>#variables.baseURL#</cfoutput>'
location.href=baseURL+'/support/supportform.cfm?referrer=' +
escape(url);
}
</script>
</head>
<body onload="forward(document.location.href)"></body>
</html>
 
Never mind. I figured it out. I abandoned the idea of using
window.open or body onload events and opted to use a Meta Refresh tag.
Here's the solution in case anyone's interested.

<html>
<head>

<cfparam name="variables.baseURL" default="http://www.mycompany.com">

<cfif CGI.SERVER_NAME CONTAINS "devnew">
<cfset variables.baseURL="http://devnew.mycompany.com"/>
</cfif>
<base href="<cfoutput>#variables.baseURL#</cfoutput>">
<script type="text/javascript" language="javascript1.2">
var baseURL = '<cfoutput>#variables.baseURL#</cfoutput>'
var redirectURL =
document.location.href=baseURL+'/support/supportform.cfm?referrer=' +
escape(document.location.href);
</script>
<META HTTP-EQUIV="REFRESH" CONTENT="0;
URL=document.write(redirectURL)">
</head>
<body></body>

</html>
 
Never mind. I figured it out. I abandoned the idea of using
window.open or body onload events and opted to use a Meta Refresh tag.
Here's the solution in case anyone's interested.

<html>
<head>

<cfparam name="variables.baseURL"
default="http://www.scottforesman.com">

<cfif CGI.SERVER_NAME CONTAINS "devnew">
<cfset variables.baseURL="http://devnew.scottforesman.com"/>
</cfif>
<base href="<cfoutput>#variables.baseURL#</cfoutput>">
<script type="text/javascript" language="javascript1.2">
var baseURL = '<cfoutput>#variables.baseURL#</cfoutput>'
var redirectURL =
document.location.href=baseURL+'/support/supportform.cfm?referrer=' +
escape(document.location.href);
</script>
<META HTTP-EQUIV="REFRESH" CONTENT="0;
URL=document.write(redirectURL)">
</head>
<body></body>

</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top