Won't work on FireFox

A

Alex

Something is wrong, the </script> tag in the string for some reason is
the cause from what I can figure. When I remove it, it runs but not as
it should since it is a broken HTML then.

<html><head></head><body>
<script language="javascript">
function showme(){
a=window.open("","Thank You","status=1,width=350,height=150");
a.document.write('<html><body><img
src="http://www.google.com/intl/en/images/logo.gif"><script
language="javascript">window.location="http://www.aol.com"</script></body></html>');

a.document.close();}
showme();
</script>
</body></html>
 
J

Joshie Surber

The JS interpreter sees the </script> inside your string and closes the
script. This may not be the Right Thing, but a simple workaround would
be to replace </script> with </'+'script inside the string.
 
D

David Dorward

Joshie said:
The JS interpreter sees the </script> inside your string and closes the
script. This may not be the Right Thing,

It is "the right thing", and there are further errors in the markup that the
validator would pick up.
but a simple workaround would
be to replace </script> with </'+'script inside the string.

Simpler would be: <\/script>
 
O

One Dumm Hikk

The JS interpreter sees the </script> inside your string and closes the
script. This may not be the Right Thing, but a simple workaround would
be to replace </script> with </'+'script inside the string.

And that can still cause errors. It's not the "JS interpreter" but
rather the HTML parser that looks, and it isn't looking for </script>,
it can simply look for </ and end the script block.

The "correct" solution is to escape the / in the tag:

<\/script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top