Link to home
Create AccountLog in
Avatar of PapaparaTudu
PapaparaTudu

asked on

Breaking long links

hi,
I'm looking for a way to break long links in my page into multiple lines as currently the page gets skewed because of them. It doesn't look like HTML supports this - I tested the <pre> tag but it only seems to affect strings that contain whitespaces. Is there any way to achieve that so that it works in all these browsers: IE, Firefox, Safari, Opera?

Thanks!
Avatar of gamebits
gamebits
Flag of Canada image

If they are hard coded you could use a service like tinyurl I guess

http://tinyurl.com/
You could have the link call a javascript function to load the url based on the link ID, or some such thing.
You could also try detecting the length of the url string using ASP.NET and formatting it so it displays something like this:
<a href="http://www.google.com/some/web/site/index.aspx">http://www.google.com/.../index.aspx</a>

Open in new window

Avatar of PapaparaTudu
PapaparaTudu

ASKER

Karai_17: I like your solution most so far. tinyurl is not what I'm looking for. Link id seems like a  complicated idea.

Actually now I have realised that I would need this functionality not only for links, but also for simply long words. I could detect long words with ASP.NET and if they're over a certain length, I could insert a new line after that position.

Any other ideas?
ASKER CERTIFIED SOLUTION
Avatar of Karai_17
Karai_17
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account