Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identifying a homepage

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

Need to programatically determine a homepage from a URL.
Code:
[URL unfurl="true"]http://www.tek-tips.com/threadminder.cfm?pid=215&page=1#postform[/URL]
The third "/" in the string marks the end of the homepage, so
Code:
[URL unfurl="true"]http://www.tek-tips.com/[/URL]
is the homepage.

What exceptions are there going to be to this theory, please?

TIA

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.co.uk
 
Chris

Thanks for your response.

By way of further information, the URL is derived in only two ways.

[ol]
[li]OLE Drag 'n drop from the browser addressbar onto a form, whereby the dropped data is the string of the displayed URL[/li]


[li]OLE Drag 'n drop from a link or favourite onto a form where the dropped data is *.url, and the file is parsed to extract the string[/li]
[/ol]

To my knowledge, both versions are normalised under all circumstances unless someone can advise to the contrary?

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.co.uk
 

One exception I can think of immediately is when the protocol specified in the URL is file instead of http. For example:

Code:
file:///c:/myfile.html

I'm sure that there may also be exceptions for other protocols.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
You should also remember that if there no third backslash (although some browsers add this if missing), for example:

Code:
[URL unfurl="true"]http://www.google.co.uk[/URL]

then you should just take all text after the second backslash.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top