Ignore fragment-only links.

We don't handle URLs with fragments exactly ;-) well - meaning we send the fragment part to the server and we don't display the document starting at the anchor tag. Instead of adding the missing capabilities and thus adding lots of code I instead opted to simply ignore fragment-only links. This approach is based on the practical knowledge that fragments are primarily used for intra-document navigation - and are as such fragment-only links. And as we ignore them anyway when displaying the document it's more ergonomic to not have those links in the first place.
This commit is contained in:
Oliver Schmidt 2015-05-25 18:18:44 +02:00
parent 9b9b92be06
commit cdd289a7ff
1 changed files with 8 additions and 3 deletions

View File

@ -170,11 +170,12 @@ static struct inputattrib *currptr;
#define ISO_nl 0x0a
#define ISO_space 0x20
#define ISO_hash 0x23
#define ISO_ampersand 0x26
#define ISO_plus 0x2b
#define ISO_plus 0x2b
#define ISO_slash 0x2f
#define ISO_eq 0x3d
#define ISO_questionmark 0x3f
#define ISO_questionmark 0x3f
/* The state of the rendering code. */
static char *webpageptr;
@ -886,7 +887,11 @@ htmlparser_word(char *word, unsigned char wordlen)
void
htmlparser_link(char *text, unsigned char textlen, char *url)
{
add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0);
if(url[0] == ISO_hash) {
htmlparser_word(text, textlen);
} else {
add_pagewidget(text, textlen, url, CTK_WIDGET_HYPERLINK, 0);
}
}
/*-----------------------------------------------------------------------------------*/
#if WWW_CONF_FORMS