Posts 1 - 10 of 39
First | Prev. | 1 2 3 4 | Next | Last
|
|
grchen168
Guest
|
I can modify downloaded html content following your code something like the following:
private void IEModule_OnDataAvailable(object sender, ADXIEDataAvailableEventArgs e)
{
if (e.DataState == ADXIEDataAvailableEventArgs.ADXIEReportDataState.DataReadyForDownload)
{
e.PreviewData = true;
}
else
if (e.DataState == ADXIEDataAvailableEventArgs.ADXIEReportDataState.DataFullyAvailable)
{
if (e.Data != null && e.Data.Length > 0)
{
Encoding encoding = GetEncoding(e.Options, e.CodePage);
string htmlSource = encoding.GetString(e.Data.GetBuffer());
if (ModifyHTMLCode(ref htmlSource))
{
e.Data.SetLength(0);
byte[] bytes = encoding.GetBytes(htmlSource);
e.Data.Write(bytes, 0, bytes.Length);
e.UpdateCacheFile(false);
}
}
}
}
Question is, how , the above code to be modified, to exclude normal document files (ex: pdf, doc,..., to name a few)?
PS: I try to add 'content-type' filtering in the ADXIEReportDataState.DataFullyAvailable case, but to no avail. |
|
Posted 15 Jun, 2015 14:33:38
|
|
Top
|
|
grchen168
Guest
|
BTW, in the ADXIEDataAvailableEventArgs.ADXIEReportDataState.DataFullyAvailable case, one way to achieve filtering document files is using, take pdf as example, e.url.EndWiths('.pdf'). But hope more elegant way to fullfil filtering every 'save-as' document file (maybe, picture file also) downloaded. |
|
Posted 15 Jun, 2015 14:54:20
|
|
Top
|
|
grchen168
Guest
|
Hope to hear your feedback soon.
Thanks. |
|
Posted 15 Jun, 2015 23:22:42
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hello,
Please try to use e.Url to filter documents. The ContentType property should be used when e.DataState is set to DataMimeTypeAvailable.
E.g.
private void IEModule_OnDataAvailable(object sender, ADXIEDataAvailableEventArgs e)
{
if (IsTargetDomain(e.Url))
{
switch (e.DataState)
{
case ADXIEDataAvailableEventArgs.ADXIEReportDataState.DataMimeTypeAvailable:
if (e.ContentType.StartsWith("text/html"))
e.PreviewData = true;
break;
case ADXIEDataAvailableEventArgs.ADXIEReportDataState.DataFullyAvailable:
if (e.Data != null && e.Data.Length > 0)
{
Encoding encoding = GetEncoding(e.Options, e.CodePage);
string htmlSource = encoding.GetString(e.Data.GetBuffer());
if (InjectHTMLCode(ref htmlSource))
{
e.Data.SetLength(0);
byte[] bytes = encoding.GetBytes(htmlSource);
e.Data.Write(bytes, 0, bytes.Length);
e.UpdateCacheFile(false);
}
}
break;
}
}
} |
|
Posted 16 Jun, 2015 07:04:42
|
|
Top
|
|
grchen168
Guest
|
Hi,
After trying what you indicated, it seems while download pdf document, the IE's downloading progress is hanged! (that is, stop at some percentage, and no further progressing)
Btw, normal web page (ie, contenttype='text/html')is rendering OK.
Can you help check for it? |
|
Posted 16 Jun, 2015 08:19:25
|
|
Top
|
|
grchen168
Guest
|
BTW, "try to use e.Url to filter documents" - do you mean something like the following filtering way?
if((e.Url.EndsWith(".pdf"))||(e.Url.EndsWith(".doc"))||.....blah blah....)
It is not preferable way, because it is not possible to enumerate all possible document file types. |
|
Posted 16 Jun, 2015 11:31:49
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi,
When a pdf document is downloaded, 'e.ContentType' is 'application/pdf'. I can't reproduce the issue. Please send me a url for testing. |
|
Posted 17 Jun, 2015 03:45:57
|
|
Top
|
|
grchen168
Guest
|
You can try the following url for download pdf file:
http://support.epson.com.tw/i-tech/0906241100.pdf
As using the previous code snippet (ie, for OnDataAvailable event and only handling DataMimeTypeAvailable/DataFullyAvailable status as your code shown), the downloading will wait for completion! |
|
Posted 23 Jun, 2015 08:07:51
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi,
I can't reproduce the issue in Windows 8.1/IE 11. What the operating system and IE version do you use?
Do you use the latest version of Add-in Express v9.2.6124.0? |
|
Posted 24 Jun, 2015 05:50:19
|
|
Top
|
|
grchen168
Guest
|
My env is Win7 Ultimate (sp1, 64bit) + IE10 (v10.0.9200.17148),
and using the latest ADXIE v9.2.6124.0
Can you help verify it as same as possible?
Thank you in advance. |
|
Posted 26 Jun, 2015 07:32:07
|
|
Top
|
|
Posts 1 - 10 of 39
First | Prev. | 1 2 3 4 | Next | Last
|