Welcome to WebmasterWorld Guest from 54.156.56.73

Forum Moderators: incrediBILL

Message Too Old, No Replies

Removing spaces from an a href line

     
5:28 pm on Jul 1, 2014 (gmt 0)

New User

joined:July 1, 2014
posts: 3
votes: 0

Hey - I'm looking for a way to remove spaces from a <a href> tag.

I am wondering if there is anyway to code a link with spaces (or null identifiers) that will drop once the link is clicked - for example.. for more complicated reasons I cannot use www or .com in the <a href> link as it will not be read properly in the field it is being submitted.. I need to be able to write it something like:

<a href="ww w.mylink . com">

With spaces in such places or some other identifier - but when the link is clicked it needs to be read

www.mylink.com

without any spaces..

You have probably guessed that the original link would be read ww%20w.mylink%20.%20com I need the spaces removed but NOT replaced with %20.. how can I do this?
6:23 pm on July 1, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


JavaScript will need to run when the element is clicked, or when the resulting page is loaded - can you run some (custom) JavaScript?! Note also, that you need "http://" at the start of the URL.
7:34 pm on July 1, 2014 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13827
votes: 484


I think it would be useful to explain the backstory. There may be some alternative way of getting to the result you want. There's definitely nothing you can do in HTML alone.

the original link would be read ww%20w.mylink%20.%20com

This detail may in fact depend on the browser. Camino quietly eats any spaces in an URL; Safari doesn't.
12:50 pm on July 15, 2014 (gmt 0)

New User

joined:July 1, 2014
posts: 3
votes: 0


Maybe it is for the best - I wanted to use html to link to my guild's homepage via the in game chat in an online browser game... I figured out that I can use html to change colors and even make a link.. However the chat censors phrases like www and .com so I was needing to be able to write ww w and . com with spaces etc... I'm beginning to feel like their censors did not want this to occur which is why Im having so much trouble cheating it - so like I said maybe its for the best - we shouldn't aim to beat the censor in any game or chat...
2:04 pm on July 15, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


I'm beginning to feel like their censors did not want this to occur which is why Im having so much trouble cheating it


Exactly. Spammers are constantly trying to post links to their products - so it is often something that is crippled in user submitted data. Even if you did manage to "cheat it", it is unlikely to benefit you SEO wise (if that was the intention?).
1:15 pm on July 21, 2014 (gmt 0)

New User

joined:July 1, 2014
posts: 3
votes: 0


-

[edited by: lostimewaiting at 1:16 pm (utc) on Jul 21, 2014]

1:15 pm on July 21, 2014 (gmt 0)

New User

joined:July 1, 2014
posts: 3
votes: 0


nah nothing that interesting (lol) I just wanted to be able to put a nice little recruitment message with a link to my gamer guild's home page - I'll give up on it - as I said we shouldn't aim to beat any censor they are likely there to protect someone or their assets.... best to help offer that protection than to be a hinderance I suppose =)