Forum Moderators: open

Message Too Old, No Replies

Force long URL's to wrap

Even if there's no natural breaking point

         

MatthewHSE

8:39 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got a "refer this page" system on my site where visitors can click a link on PageX.html, and are taken to a page where they can fill out a form to have a link to PageX.html e-mailed to their friends. Above the form is the complete URL of the page they want to refer.

The problem is, many of my URL's, such as my forum pages, are quite long. The result is that the long URL of the page being referred stretches out my page width to be way too wide.

Is there any way to get that URL to break at the edge of the div it's placed in, without stretching it out, even if there's no natural breaking point in the URL?

Even a javascript solution would be appreciated . . . :)

Thanks,

Matthew

DrDoc

9:34 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Let's put it this way... Is it important that the whole URL is showing, or would it be ok if it got cut off, like:

[webmasterworld.com...]

MatthewHSE

10:03 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It could be cut off if necessary. Only the first part of the URL counts anyway.

The only thing I'm anxious to avoid is a scrolling div . . .

DrDoc

10:11 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, you can always do something like:

<script type="text/javascript">
document.write(url.substr(0,##));
</script>

## is the number of characters allowed

You can also wrap the URL in:

<div style="width: ##px;overflow:hidden;">URL</div>

TheDoctor

9:57 pm on Oct 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or you code the html as

<a href="http://www.webmasterworld.com/edposts.cgi?action=reply&forum=21&discussion=6477"> http://www.webmasterworld.com/ edposts.cgi? action=reply& forum=21& discussion=6477</a>

That is, you sprinkle spaces at strategic points in the anchor text. What you show in the anchor text doesn't have to be literally correct. It just has to give the reader the impression that it is.