473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to Remove "http://localhost" from my URLs

I am testing a web app that links to user defined URLs. I want the link
to be the exact text the user provided but I can't seem to get rid of
the "http://localhost" prefix in the link. Note that I am user defined
email addresses for "mailto:" links and the same problem occurs.

Is this something that will be removed when the site is published?

All help is appreciated,
Lee

Feb 7 '06 #1
3 5006
Does this prefix appear in the generated HTML code of the web page? Or is it
the browser who is too smart?

"Lee Roth" <le******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I am testing a web app that links to user defined URLs. I want the link
to be the exact text the user provided but I can't seem to get rid of
the "http://localhost" prefix in the link. Note that I am user defined
email addresses for "mailto:" links and the same problem occurs.

Is this something that will be removed when the site is published?

All help is appreciated,
Lee

Feb 8 '06 #2
It's the browser. The HTML in the code is basic. For example:

string userURL = userURLTextBox.Text; // say the user inputs
"www.google.com"
string htmlCode = "<a href = " + userURL + "> User Link </a>";

But instead of just google the link becomes
"http://localhost/www.google.com" which is a page it obviously can't
find.

So how do I use the code to make sure this doesn't happen to the end
users?

Thanks,
Lee

Feb 8 '06 #3
Hey Lee,

You can automatically prefix any user input with http:// if the input does
not start with any protocol specification (bear in mind that these are not
only http:// or https://, can also be ftp:// or even telnet://)

"Lee Roth" <le******@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
It's the browser. The HTML in the code is basic. For example:

string userURL = userURLTextBox.Text; // say the user inputs
"www.google.com"
string htmlCode = "<a href = " + userURL + "> User Link </a>";

But instead of just google the link becomes
"http://localhost/www.google.com" which is a page it obviously can't
find.

So how do I use the code to make sure this doesn't happen to the end
users?

Thanks,
Lee

Feb 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: aa | last post by:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini in php.ini I have: SMTP = localhost SMTP_PORT = 25...
24
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html...
3
by: Robin Tucker | last post by:
Should I consider this to work in other locales? If theServer.Name <> "(local)" and theServer.Name <> "(localhost)" Then ' Can only use local machine in this version..... End If
31
by: Yeah | last post by:
Is it absolutely necessary to include "http://" in an A HREF hyperlink? Would it be wise to remove this from one's Links page, just to save code?
5
by: KenLee | last post by:
help: how can I change from "//localhost:numbers/" to just "//localhost/"? I can see the web pages using "//localhost:numbers/" instead of ""//localhost/". I use asp.net 2.o. and windows 2000....
3
by: John Nagle | last post by:
I'm getting a wierd error from urllib2 when opening certain URLs. The code works for most sites, but not all of them. Here's the traceback: InfoSitePage EXCEPTION while processing page...
0
by: almurph | last post by:
Folks, Hope that you can help me here. Just a quick question. I as using IIS 5.1 and can download a web service from SourceSafe onto my developers box. Let call the project "WebServiceA" ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.