473,498 Members | 1,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

href confusion

Nak
Hi there,

I know this isn't 100% relevant to ASP.NET but I'm hoping that someone
can shed some light on href's in HTML code.

Consider the following,

http://www.spoon.com/dir/page.html

I'm trying to work out the relationship between href's on the above page
and the pages own URI, for example, am I right in saying the following is
correct,

"/dir2/page.html" < Would become
http://www.spoon.com/dir2/page.html
"dir3/page.html" < Would become
http://www.spoon.com/dir2/dir3/page.html
"../page4.html" < Would become
http://www.spoon.com/page4.html

The reason I ask is that I am making an HTML href parser and this has
recently caused me much confusion. Also, are speech marks actually needed?
Because I've analyzed a few pages lately that haven't had any, for example

href="http://www.spoon.com/none/error.html"

and

href=http://www.spoon.com/none/error.html Correct ?

Thanks loads in advance for any help and sorry if this seems irrelivant
to ASP.NET but I was convinced that you guys would know this one.

Nick.
Nov 18 '05 #1
4 1215
Nak wrote:
Consider the following,

http://www.spoon.com/dir/page.html

I'm trying to work out the relationship between href's on the above page
and the pages own URI, for example, am I right in saying the following is
correct,

"/dir2/page.html" < Would become
http://www.spoon.com/dir2/page.html
"dir3/page.html" < Would become
http://www.spoon.com/dir2/dir3/page.html
"../page4.html" < Would become
http://www.spoon.com/page4.html
Your understanding is correct.
href="http://www.spoon.com/none/error.html"

and

href=http://www.spoon.com/none/error.html Correct ?


XHTML requires that there be quotes around element attributes. I
believe HTML says there should be quotes there, but many browsers aren't
picky about it. Good HTML authors always use quoted attributes.

hth

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #2
Answers are inline

"Nak" wrote:
Hi there,

I know this isn't 100% relevant to ASP.NET but I'm hoping that someone
can shed some light on href's in HTML code.

Consider the following,

http://www.spoon.com/dir/page.html

I'm trying to work out the relationship between href's on the above page
and the pages own URI, for example, am I right in saying the following is
correct,

"/dir2/page.html" < Would become
http://www.spoon.com/dir2/page.html
"dir3/page.html" < Would become
http://www.spoon.com/dir2/dir3/page.html
"../page4.html" < Would become
http://www.spoon.com/page4.html
Yes this is correct.

The reason I ask is that I am making an HTML href parser and this has
recently caused me much confusion. Also, are speech marks actually needed?
Because I've analyzed a few pages lately that haven't had any, for example

href="http://www.spoon.com/none/error.html"

and

href=http://www.spoon.com/none/error.html Correct ?
Read this article.....
http://ferruh.mavituna.com/article/?569
Thanks loads in advance for any help and sorry if this seems irrelivant
to ASP.NET but I was convinced that you guys would know this one.

Nick.

Nov 18 '05 #3
Nak
Hi Scott,
Your understanding is correct.
Excellent, thanks!
XHTML requires that there be quotes around element attributes. I
believe HTML says there should be quotes there, but many browsers aren't picky about it. Good HTML authors always use quoted attributes.
That's a shame, I hate it when the standards get dropped, a bit like 3rd
party msstyles files, parsing those is a complete nightmare!

Nick.

"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:5Y******************@newssvr13.news.prodigy.c om... Nak wrote:
Consider the following,

http://www.spoon.com/dir/page.html

I'm trying to work out the relationship between href's on the above
page and the pages own URI, for example, am I right in saying the
following is correct,

"/dir2/page.html" < Would become
http://www.spoon.com/dir2/page.html
"dir3/page.html" < Would become
http://www.spoon.com/dir2/dir3/page.html
"../page4.html" < Would become
http://www.spoon.com/page4.html

href="http://www.spoon.com/none/error.html"

and

href=http://www.spoon.com/none/error.html Correct ?


hth

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Nov 18 '05 #4
Nak
Hi Mike,
Yes this is correct.
Cool, cheers!
Read this article.....
http://ferruh.mavituna.com/article/?569


I shall indeed, thanks both for your helps! ;-)

Nick.
Nov 18 '05 #5

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

Similar topics

14
2464
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only....
7
1553
by: Jack | last post by:
Hi, I am trying to get a printer.asp page linked back to a main report page. However, in the final url, the grantid is missing which should not be, if the href statement is correct. I checked the...
10
2821
by: Bill H | last post by:
I used a bit of JS on a page that is fairly long and didn't like the way that <A HREF='#' ONCLICK=\"... refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...) solved my...
8
8195
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
1
3148
by: Richard Lewis Haggard | last post by:
I'm having a problem with what appears to be some sort of confusion with references. I have a single solution with a dozen projects which has been working quite nicely for a while. The references...
8
2235
by: Prisoner at War | last post by:
Another weekend, another project, another problem.... Why should a perfectly fine function work only half-way through when called through onClick in an anchor tag?? The text fade-in script...
2
1993
by: Peter Laman | last post by:
In my app I need to dynamically generate a series hyperlinks. Each hyperlink's action must be to focus a field in a <form>. I created the following function to create such a link (the argument is a...
10
21493
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value...
5
1332
by: misterkeitel | last post by:
Hi! I've really tried to seach and see if this questions has been asked and answered before. But I was unable to find it. Probably because I was not asking it in the right way. I'm going to try...
0
7126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7210
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
659
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.