Forum Moderators: open

Message Too Old, No Replies

a href and '&'

Why does IE crash if an '&' is used in the link text

         

nigassma

1:28 am on Sep 28, 2005 (gmt 0)

10+ Year Member



Why does this crash IE?

<li><a href="somewhere.htm">Somewhere & Nowhere</a></li>

or

<li><a href="somewhere.htm">Somewhere &amp; Nowhere</a></li>

What's with the "&" in the link text that crashes IE?

-NickG

Dijkgraaf

2:47 am on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The first one wouldn't validate if you were validating the HTML, but neither one causes IE to crash for me.

So either there is something wrong with the page you are going to, or there is something wrong with your particular environment.

Try running spyware/adware/virus scans.

nigassma

3:17 am on Sep 28, 2005 (gmt 0)

10+ Year Member



Strange ey? It's not just my home computer, but my work and my coworkers pc also.

It's an unorderd list and the li's within the <ul> are links. Whether it is in a SSI or a DW library item it still crashes IE. At first both links were &amp; then I changed them to & and then I just removed them. When I removed the & it worked. So I've actually gone to using a / instead of the &.

so it looks like this:

<div id="nav">
<ul>
<li><a href="/lowerschool/curricula/language_arts.htm">Language Arts</a></li>
<li><a href="/lowerschool/curricula/math.htm">Mathematics</a></li>
<li><a href="/lowerschool/curricula/sciene.htm">Science</a></li>
<li><a href="/lowerschool/curricula/social_studies.htm">Social Studies</a></li>
<li><a href="/lowerschool/curricula/spanish.htm">Spanish</a></li>
<li><a href="/lowerschool/curricula/computer_science.htm">Computer Science & Technology</a></li>
<li><a href="/lowerschool/curricula/performing_arts.htm">Performing Arts</a></li>
<li><a href="/lowerschool/curricula/visual_art.htm">Visual Art</a></li>
<li><a href="/lowerschool/curricula/physical_ed.htm">Physical Education</a></li>
<li><a href="/lowerschool/curricula/library.htm">Library</a></li>
<li><a href="/lowerschool/curricula/study_skills.htm">Study Skills &amp; Character Dev.</a></li>
</ul>
</div>

Dijkgraaf

4:12 am on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Very strange! I put the above snippet of code into a page and no problems encountered.

Robin_reala

6:22 am on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does your page validate? Can you post the whole code?

tedster

6:35 am on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree that you should validate the page first. I've never seen an ampersand crash a browser if the mark-up is valid. However, if you are missing a close quote in an href attribute - then the browser will see a really long url with a potentially monsterous query string.

Please do try validating first, especially the html:

W3C Validator - HTML [validator.w3.org]
W3C Validator - CSS [jigsaw.w3.org]

nigassma

4:32 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



Validates. That is the code. It is a SSI. What really perplexes me is that on some pages an ampersand crashes the page and on some it doesnt. It's driving me nuts. Here's a page that crashes.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../css/section_headpage.css" rel="stylesheet" type="text/css">
<link href="../../css/simplenav.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../../javascript/p7popmenu.js"></script>
<style type="text/css" media="screen">
<!--
@import url("../../css/p7pmh0.css");
-->
</style>
<!--[if lte IE 6]>
<style>
#p7PMnav a {height: auto!important;}
#p7PMnav ul a {height: 1em!important;}
#p7PMnav a{height:1em;}
#p7PMnav li{height:1em;}
#p7PMnav ul li{float:left;clear:both;width:100%}
</style>
<![endif]-->
<!--[if IE 6]><style>#p7PMnav ul li{clear:none;}</style><![endif]-->
</head>
<body onload="P7_initPM(1,0,1,0,0)">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="curvebar"><img src="../../images/headers/ms_curricula.gif" width="800" alt="MS Curricula"></td>
</tr>
<tr>
<td id="topnav"><!--#include virtual="/nav.htm"--></td>
</tr>
</table>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="left"><!--#include virtual="/includes/middleschool_nav.htm"--></td>
<td id="center" class="pfix"><p><strong> ENGLISH </strong></p>
<p></p>
<p><strong> Reading Selections </strong></p>
<p><strong> Grade 6:</strong> Short stories, poetry, <em>Anne Frank</em> and
either <em>The War of the Worlds</em> or <em>The Pearl</em>. </p>
<p><strong> Grade 7:</strong> Short stories, poetry, plays<em>, Julius
Caesar</em>, <em>Animal Farm</em>, and <em>Farenheit 451</em> or <em>The
Old Man and the Sea</em>. </p>
<p><strong> Grade 8:</strong> Short stories, poetry, plays, <em>Romeo
and Juliet</em>, and <em>Great Expectations</em>. </p>
<p><strong> Expository Writing </strong></p>
<p></p>
</td>
<td id="right"><!-- #BeginLibraryItem "/Library/mscourselist.lbi" --><ul class="nobullet">
<li><a href="english.htm">English</a></li>
<li><a href="math.htm">Mathematics</a></li>
<li><a href="science.htm">Science</a></li>
<li><a href="social_studies.htm">Social Studies</a></li>
<li><a href="languages.htm">Modern &amp; Classical
Languages</a></li>
<li><a href="computer_science.htm">Computer Science &amp; Technology </a></li>
<li><a href="performing_arts.htm">Performing Arts</a></li>
<li><a href="physical_ed.htm">Physical Education </a></li>
<li><a href="../../academics/index.htm">K-12 Departments</a> </li>
</ul>
<!-- #EndLibraryItem --></td>
</tr>
</table>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="bottombar">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

And one that doesnt crash...

<snip>

[edited by: encyclo at 12:41 am (utc) on Sep. 29, 2005]
[edit reason] specifics and too much code [/edit]

rocknbil

4:41 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why does this crash IE?

Is this the Mac version? I have seen many situations with CSS/Tables/other elements with Mac that will crash IE, so it wouldn't surprise me. But never on the PC version.

nigassma

4:50 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



Here's another one that crashes... You know what's consistent is that the ones that are crashing are two levels up from the root (root/level1/level2/file.htm)....

<snip>

[edited by: encyclo at 12:39 am (utc) on Sep. 29, 2005]
[edit reason] too much code [/edit]

nigassma

4:51 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



Rocknbill, I work on 3 different PCs. Crashes on all of them.

IE6.

I'm stumped.

Dijkgraaf

10:21 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm starting to suspect that there may be some third party software on all three of your machines that is causing the problem. Maybe some anti-virus program or security product.

encyclo

12:50 am on Sep 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You really need to get a test page out of your curent pages to correctly identify the cause of the crash. It is most likely a combination of several factors rather than just the presence of an ampersand. The context counts, and when you have too much on a page you have too many variables to consider.

Start with a test page which is a static version (ie. with the includes placed inline within the document), then see if it still crashes. If yes, then start removing chinks of text - leave one word in each paragraph, for example. Then start removing elements, checking with each removal if the page still crashes IE. If you remove an element and the browser no longer crashes, you have one part of the puzzle.

It takes time to get to what you want, which is a test page with nothing but the exact elements needed to crash the browser, and nothing more. Once you have that, then you can use the test page to identify solutions which will solve the bug as seem on your pages.

Dijkgraaf has a good idea too - disable products such as Norton Internet Security (the ad-blocking part of that program is notorious for causing crashes as it rewrites parts of the page) or other programs such as proxies of web content filters.