468,140 Members | 1,168 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

Strange behavior with IE when writing a script that writes another script

Hello,

I have some problems with a Javascript that should redirect me to
another page, it works fine most of the times but sometimes it hangs
on a blank page.

I made lots of tests and finally I could reproduce the bug with this
little piece of code:

<script>
document.writeln("<scr"+"ipt>location='http://www.microsoft.com/';</scr"+"ipt>");
</script>

(I know it is unusual (and unnecessary) to write a script that writes
another script, but it's returned that way by a server I don't
control).

This script works. But if you use the back button more than 12 times,
then it won't work anymore. You 'll get a blank page.

Is this a feature or a bug? Do you know how to avoid that?

Thanks in advance,
Benoit Fries
Jul 20 '05 #1
1 1287
Benoit Fries wrote:
I have some problems with a Javascript that should redirect me to
another page,
That's a Bad Thing, see below.
it works fine most of the times but sometimes it hangs on a blank page.

I made lots of tests and finally I could reproduce the bug with this
little piece of code:

<script>
The `type' attribute is missing.
document.writeln("<scr"+"ipt>location='http://www.microsoft.com/';</scr"+"ipt>");
No concatenation is required here but the
ETAGO delimiter `</' should be escaped: `<\/'.
</script>

(I know it is unusual (and unnecessary) to write a script that writes
another script, but it's returned that way by a server I don't
control).
More, it is not recommended because of the Netscape Run Length
Bug (NRLB). Try that in Netscape 4.x and you get broken code
sometimes.
This script works.
Depends.
But if you use the back button more than 12 times,
then it won't work anymore. You 'll get a blank page.

Is this a feature or a bug?
I do not know since you do not explain why you hit the `Back' button
this much and from which document(s) you are navigating to which.
Do you know how to avoid that?


Use server-side redirection, this also does not break the `Back' button.
PointedEars
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

36 posts views Thread by Dmitriy Iassenev | last post: by
3 posts views Thread by Christoph Zwerschke | last post: by
10 posts views Thread by weichaoliu | last post: by
3 posts views Thread by Chuck Renner | last post: by
3 posts views Thread by t_rectenwald | last post: by
20 posts views Thread by Pilcrow | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.