Jump to content

Download Conversation feature


HugePinball

Recommended Posts

Over at the BGS Forums, they just added a feature in the Messenger that lets you print or download a conversation. Here's the new button that appears when viewing a conversation:

 

http://stashbox.org/826628/DownloadConversation.png

 

It would be great if we could get that here as well. Then I could stop working on my Greasemonkey script to do the same thing...

Link to comment
Share on other sites

The "Download Word" option works for me but the "Download HTML" does not.

 

Our firewall blocks unknown content types and this utility is sending an incorrect header.

 

WatchGuard firewall: Response denied from http://IPAddress:80/index.php: Unsafe content type "unknown/unknown"

The content type should be set to "text/html"

 

LHammonds

Link to comment
Share on other sites

It looks like both the Doctype and content type are correct. Here is the header in the html file I get from this feature:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" media="all" href="http://thenexusforums.com/public/style_css/css_5/ipb_print.css" />
<title>The Nexus Forums</title>
</head>

 

It might be a problem at your workplace/organization end.

 

BTW - I'm using Firefox, if that would explain any difference.

Link to comment
Share on other sites

It looks like both the Doctype and content type are correct. Here is the header in the html file I get from this feature:

No, the content type that the hardware firewall looks at is the actual initiation of the data stream.

 

Example: I can send text (even the exact same HTML file in your example) to your browser but tell it to initiate the data stream as MS-Word and if your computer has MS Office on it, the download will open straight in MS Word.

 

The key to the following examples is the server-side code "Response.ContentType"

 

VB Script Example:

<%@LANGUAGE="VBSCRIPT"%>
<%
'** Source: http://www.assonetriver.com/snippets/mime_types_msword_code.asp
'**
'** Tells the browser to open table using MS-Word **
Response.ContentType = "application/msword" 
%>
<html>
<head>
<title>Excel MIME Type Example</title>
</head>
<body>
Sample of MIME Type - MS-Word Server Behavior
<br><b>Response.ContentType = "application/msword"</b><br>
<br>
<table border="0" cellspacing="1" cellpadding="1">
<tr bgcolor="#999999"> 
<td><b>Remote Address</b></td>
<td><b>HTTP User Agent</b></td>
<td><b>Date</b></td>
<td><b>Server Software</b></td>
</tr>
<tr> 
<td>
<% =Request.ServerVariables("REMOTE_ADDR") %>
</td>
<td> 
<% =Request.ServerVariables("HTTP_USER_AGENT") %>
</td>
<td> 
<% = Date() %>
</td>
<td> 
<% =Request.ServerVariables("SERVER_SOFTWARE") %>
</td>
</tr>
</table>
</body>
</html>

 

Here is another example of the content type being setup as comma-delimited which Excel will open if you have it installed:

 

<%@ Language=VBScript %>
<% 
' GenerateXLS Version 1.1 by Brian Kirsten
' GenerateXLS is an ASP script that generates a comma delimited (CSV) file
' (that you can then open in Excel or some similar spreadsheet software)
' from a database. It is distributed under the GNU Public License.

DIM sTable
DIM sDSN
DIM sFields

sDSN = "<DSN>" 'Name of your DSN
sFields = "<FIELDS>" 'List of fields comma delimited
sTable = "<TABLE_NAME>" 'Name of your table or View

Set DB = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")

DB.Open sDSN
RS.Open "select "& sFields &" from "& sTable,DB
Response.ContentType = "application/csv"
Response.AddHeader "Content-Disposition", "filename=mydata.csv;"
' lets print the fields on top
for i = 0 to RS.Fields.Count - 1
 if i = (RS.Fields.Count - 1) then
   Response.Write lcase(RS.Fields(i).Name)
 else
   Response.Write lcase(RS.Fields(i).Name) & ","
 end if 
next
Response.write vbNewLine
Response.write vbNewLine
while not RS.EOF
 for u=0 to RS.Fields.Count - 1
   if u = (RS.Fields.Count - 1) then
     Response.Write RS.Fields(u).Value
   else
     Response.Write RS.Fields(u).Value & ","
   end if 
 next
 response.write vbNewLine
 rs.MoveNext
wend
Response.write vbNewLine
Response.write vbNewLine
Set RS = Nothing
Set DB = Nothing
%>

 

But regardless, this issue doesn't even come close to falling within the 80/20 rule and I have asked Dark0ne to ignore this particular issue.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...