473,493 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Changing content type

Hi,

I have a webpage delivers, let's say, a pdf document. The page is
password protected so itially it shows HTML, but when the user logs in
the page is reloaded with "window.location.reload(true)", but
IExplorer is not smart enough to realize that the content type has
changed and just spits out pdf onto the screen. How does one fix that?

Thanks!

Aaron
Jul 17 '08 #1
10 1778
Aaron Fude wrote:
I have a webpage delivers, let's say, a pdf document. The page is
password protected so itially it shows HTML, but when the user logs in
the page is reloaded with "window.location.reload(true)", but
IExplorer is not smart enough to realize that the content type has
changed and just spits out pdf onto the screen. How does one fix that?
Parse error. Please restate your request.

<http://www.jibbering.com/faq/#FAQ2_3>
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jul 17 '08 #2
On Jul 17, 2:42*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Aaron Fude wrote:
I have a webpage delivers, let's say, a pdf document. The page is
password protected so itially it shows HTML, but when the user logs in
the page is reloaded with "window.location.reload(true)", but
IExplorer is not smart enough to realize that the content type has
changed and just spits out pdf onto the screen. How does one fix that?

Parse error. *Please restate your request.
OK, fair enough. Let me try to approach this from this angle. Here's
pseudo code for my page on the server size.

if (user.notLoggedIn()) {
present.html.login.form();
when (user.submits.login.information)
window.location.reload(true);
}

else { // Now that the user has logged in...
output.a.pdf.file();
}

What happens in this scenario is that rather than invoking the acrobat
reader, the raw contents of the html file are displayed on the screen.

Does that make better sense?

Thanks!
Jul 17 '08 #3
Aaron Fude <aa*******@gmail.comwrites:
else { // Now that the user has logged in...
output.a.pdf.file();
}
I suggest the problem is here. *How* do you output the pdf?
What happens in this scenario is that rather than invoking the acrobat
reader, the raw contents of the html file are displayed on the screen.

Does that make better sense?

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Jul 17 '08 #4
On Jul 17, 4:51*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
Aaron Fude <aaronf...@gmail.comwrites:
else { // Now that the user has logged in...
* output.a.pdf.file();
}

I suggest the problem is here. *How* do you output the pdf?
I programatically produce the pdf on the fly. The PDF is produce
correctly.

I should mention that when go inside the address bar and hit Enter to
refresh the page, everything works properly. It's just a question of
IExplorer not interpreting the content type correctly.

>
What happens in this scenario is that rather than invoking the acrobat
reader, the raw contents of the html file are displayed on the screen.
Does that make better sense?

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
Jul 17 '08 #5
Aaron Fude <aa*******@gmail.comwrites:
On Jul 17, 4:51Â*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
>Aaron Fude <aaronf...@gmail.comwrites:
else { // Now that the user has logged in...
Â* output.a.pdf.file();
}

I suggest the problem is here. *How* do you output the pdf?

I programatically produce the pdf on the fly. The PDF is produce
correctly.
Again, *how*? And are you sure you're giving the right content-type
header for the PDF?
I should mention that when go inside the address bar and hit Enter to
refresh the page, everything works properly. It's just a question of
IExplorer not interpreting the content type correctly.
If that's really the case, maybe you should use a different URL for
the PDF.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Jul 17 '08 #6
On Jul 17, 5:26*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
Aaron Fude <aaronf...@gmail.comwrites:
On Jul 17, 4:51*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
Aaron Fude <aaronf...@gmail.comwrites:
else { // Now that the user has logged in...
* output.a.pdf.file();
}
I suggest the problem is here. *How* do you output the pdf?
I programatically produce the pdf on the fly. The PDF is produce
correctly.

Again, *how*? And are you sure you're giving the right content-type
header for the PDF?
Yes, I give it the right content-type as evidenced by what I said
below, but apparently IExplorer ignores it upon
window.location.reload(true)". Then on a hard refresh it reads it
properly. I'm not able to use a different URL for various reasons. I
just need to do something to force IExplorer to change the content
type.

>
I should mention that when go inside the address bar and hit Enter to
refresh the page, everything works properly. It's just a question of
IExplorer not interpreting the content type correctly.

If that's really the case, maybe you should use a different URL for
the PDF.

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
Jul 17 '08 #7
Aaron Fude <aa*******@gmail.comwrites:
On Jul 17, 5:26Â*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
>Aaron Fude <aaronf...@gmail.comwrites:
On Jul 17, 4:51Â*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
Aaron Fude <aaronf...@gmail.comwrites:
else { // Now that the user has logged in...
Â* output.a.pdf.file();
}
>I suggest the problem is here. *How* do you output the pdf?
I programatically produce the pdf on the fly. The PDF is produce
correctly.

Again, *how*? And are you sure you're giving the right content-type
header for the PDF?

Yes, I give it the right content-type as evidenced by what I said
below,
No, that's not evidence, that's a claim by you without any evidence.
but apparently IExplorer ignores it upon
window.location.reload(true)".
It might. I wouldn't be surprised if it did, but you haven't shown us
that it does.
Then on a hard refresh it reads it
properly. I'm not able to use a different URL for various reasons. I
just need to do something to force IExplorer to change the content
type.
And how do you suppose javascript figures into any of that?

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Jul 17 '08 #8
Aaron Fude <aa*******@gmail.comwrites:
OK, fair enough. Let me try to approach this from this angle. Here's
pseudo code for my page on the server size.

if (user.notLoggedIn()) {
present.html.login.form();
when (user.submits.login.information)
window.location.reload(true);
}

else { // Now that the user has logged in...
output.a.pdf.file();
}
I am also deeply suspicious of any system that relies on client-side
javascript to do user athorization. Mostly because it's completely
unreliable.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Jul 17 '08 #9
Aaron Fude wrote:
Thomas 'PointedEars' Lahn wrote:
>Aaron Fude wrote:
>>I have a webpage delivers, let's say, a pdf document. The page is
password protected so itially it shows HTML, but when the user logs in
the page is reloaded with "window.location.reload(true)", but
IExplorer is not smart enough to realize that the content type has
changed and just spits out pdf onto the screen. How does one fix that?
Parse error. Please restate your request.

OK, fair enough. Let me try to approach this from this angle. Here's
pseudo code for my page on the server size.
Not a good idea, as noted in the FAQ. Even the URL for an uncommented test
case would have been more enlightening that this.
if (user.notLoggedIn()) {
present.html.login.form();
when (user.submits.login.information)
window.location.reload(true);
}

else { // Now that the user has logged in...
output.a.pdf.file();
}

What happens in this scenario is that rather than invoking the acrobat
reader, the raw contents of the html file are displayed on the screen.

Does that make better sense?
Unfortunately not. Suppose "size" was a typo for "side", hence this being
server-side J(ava)Script (.NET), then window.location.reload(true) would not
fit in as it is a client-side method. And if server-side scripting was not
meant with this, I wonder what client-side scripting would have to do with a
login, which should be secure. And even if made possible so in any way, why
would it be necessary to reload the entire document, discarding everything
done so far?

ISTM your approach is completely wrong, and you should read on how to built
a client-server Web application properly.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jul 17 '08 #10
Aaron Fude wrote:
I have a webpage delivers, let's say, a pdf document. The page is
password protected so itially it shows HTML, but when the user logs in
the page is reloaded with "window.location.reload(true)", but
IExplorer is not smart enough to realize that the content type has
changed and just spits out pdf onto the screen.
and
if (user.notLoggedIn()) {
present.html.login.form();
when (user.submits.login.information)
window.location.reload(true);
}
else {
output.a.pdf.file();
}
I'm afraid there is something wrong with your logic.
'output.a.pdf.file()' can not be used to load a PDF-document inside
the same web page, because the page was already served with content-
type text/html or the like. The only possibility is that
'output.a.pdf.file()' requests a new URI, like...

self.location.href = 'path/to/file.pdf';

....which initiates a fresh clean GET-request and response.

When you would use 'location.reload()', it refreshes exactly the same
URI (so, with the full HTML and the javascripts in it). By that time
you can't turn back the clock anymore to serve PDF on second thought.

Hope this helps,

--
Bart
Jul 18 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3152
by: mvargasp | last post by:
Hi all, I have a web form which contains a frame, (a form containing a menu on the left and a web form containing a datagrid on the right). Also there is a button (right side) which transforms...
4
16186
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what...
3
5946
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change...
2
5232
by: rpesq | last post by:
Hi, I Need help changing the content of a DIV. I sincerely researched the issue and have not found a solution except to scrap the idea and stick with the iframe code that I had been using. My...
2
2335
by: John Dalberg | last post by:
The below html validates correctly on w3.org's html validator when the file has an html extension. When the same file gets an aspx extension, I get the error below from the validator. This tells me...
1
1798
by: Pablo | last post by:
I do not know like changing the color of bottom of: a menu, of the bar of the title of form, messagebox?
1
2392
by: mike | last post by:
Hi, I'd like advice from a .NETer. I have a loadcombo routine which sets the selectedindex to -1 if it's an "add record", but then it goes to a security routine which, based on permissions...
5
2187
by: pb | last post by:
Do anyone know how to change the .aspx extension to something else, say ..sssx, for all or part of a ASP.NET 2.0 site? I recall a Microsoft article on this some time ago, but I cannot locate it.
4
1821
by: Siah | last post by:
Hi, I wanted to dynamically update pieces of my page in the following fashion. Look at the following html code: <span id='person_23_name'> Mike </span> <span id='person_28_name'> Siah </span>...
0
6989
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1400
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.