Jump to content

In XHTML, can a long href value be continued?


pjfarley3
 Share

Recommended Posts

Can a long href value be continued onto 2 or more lines? I have a situation that requires keeping the longest line length at 72 or below, and with proper indentation used, the href value for aome anchors will not fit on the line.I coded it like this: <a href="/really/long/web/address/with?VARIABL1=VALUE1&VARIABL2=VALUE2&VARIABL3=VALUE3" />HTML Tidy gives a Warning for this line, saying "<a> discarding newline in URI reference".The DOCTYPE I am using is XHTML 1.0 Transitional.TIA for any pointers to the rules.Peter

Link to comment
Share on other sites

I think you can safely pass 256 characters in the address bar. but maybe into the thousands i'm not sure how each brower reacts. You can have a href on 2 lines just as long as you don't use any carage returns, let the editor naturaly start a new line

Edited by scott100
Link to comment
Share on other sites

I think you can safely pass 256 characters in the address bar.

It isn't the total length I am asking about, it's the syntax of breaking the href value into two or more lines.In C, f'rinstance, to continue a character literal I code a backslash at the end of the first line and continue the literal at byte 1 of the next line. In current COBOL syntax, you can continue a character literal by coding a hyphen in column 7 and then a quote/apostrophe where you want to continue the literal on that line.I am asking IF the href value can be continued, and IF SO, then whether the syntax I showed (continue at byte 1 of next line) is legal for XHTML 1.0 Transitional.Peter[edit] I should be a little more clear: Is it legal in the XHTML SOURCE file, *not* if it is legal in the address bar of the browser. For reasons I won't go into, the SOURCE file line length has to be 72 or less, so a really long href value just does not fit on one source file line.
Link to comment
Share on other sites

just type it in and let notepad automatically wrap it. then it will be fine.LG

Sorry, that doesn't help. Notepad wrapping is on-screen only -- the line that gets stored in the file is everything up to the point where you type "Enter". You can see this if you type a line that wraps to 2 or more lines, then go to the View menu and click OFF the Word-Wrap feature. The text that looked like it was on multiple lines is really all on one single line.For reasons I can't go into here, the actual line length in the XHTML source file needs to be 72 or less, so I need to know if breaking the href value at the end of 72 bytes is legal.Thanks for trying to help though.Peter
Link to comment
Share on other sites

For reasons I can't go into here, the actual line length in the XHTML source file needs to be 72 or less, so I need to know if breaking the href value at the end of 72 bytes is legal.

You cannot break the href at all, if you do it doesn't validate. AFAIK with html there is not syntax to allow for character continuation on a new line.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...