Ticket #89 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Add javascript support for <relocate/> tag

Reported by: mike@… Owned by: scorfield
Type: enhancement Priority: normal
Milestone: Fusebox 5.1 Component: Miscellaneous
Version: 5.0 Severity: normal
Keywords: Cc:

Description

In PHP there's a provision set up in the <relocate/> tag that tests for the existence of any http headers sent to the browser. If there are any it automatically switches from a header-based Location: call to a block of javascript code instead. This makes <relocate/> safe to use in a fuseaction where the current fuseaction is no longer considered a "virtual" page.

Here's a rough draft on what the code generated in the parsed fuseaction might look like for this:

<cfset fb_.httpreq = GetHTTPRequestData()>
<cfif not StructKeyExists(fb_.httpreq,'headers') or not IsArray(fb_.httpreq.headers) or ArrayLen(fb_.httpreq.headers) eq 0>
<cflocation url="#fb_verbInfo.attributes.url#" addtoken="#fb_verbInfo.attributes.addtoken#">
<cfelse>
<cfoutput><script type="text/javascript">( document.location.replace ) ? document.location.replace("#fb_verbInfo.attributes.url#") : document.location.href = "#fb_.verbInfo.attributes.url#";</script></cfoutput>
</cfif>

Attachments

Change History

Changed 2 years ago by scorfield

  • owner changed from sean@corfield.org to scorfield
  • status changed from new to assigned
  • version set to 5.0
  • milestone set to Fusebox 5.1

Changed 2 years ago by scorfield

GetHTTPRequestData() does not provide access to outbound headers, only inbound headers. I looked at getPageContext().getResponse() which allows you to test if a *specific* header has been sent but does not let you retrieve all outbound headers.

I think the only realistic approach here is to add an explicit option to output a JavaScript?-based relocate. Ticket #128 also talks about doing some work on the relocate verb.

Changed 2 years ago by scorfield

  • status changed from assigned to closed
  • resolution set to fixed

(In [273]) Fixes #89 and #128 by adding two new types: moved and javascript.

Note: See TracTickets for help on using tickets.