Charsets && external links

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Charsets && external links

Post by Chalks »

I'm building a website for my Spanish class (mainly for my own use, really). I recently checked to see if the code was xhtml valid... it wasn't. One of the things missing was a charset. I have a lot of characters that I don't normally use, like:
í é ó á etc.

What charset should I be using? Is utf-8 good? I have no idea, really. Also, am I doing this right for xhtml strict?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Spanish Helper - Jonathan Walters</title></head><body><p>Stuff...


edit: whew. Got one of my pages with over 170 validation errors to validate. Now I have a problem. xhtml doesn't like target="_blank". I'm trying to use this workaround, but... it's not working. I'm not sure why? Here is where I'm trying to use it.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Charsets && external links

Post by matthijs »

First question is: why do you need target blank? There is a reason it's depracated
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Re: Charsets && external links

Post by Chalks »

matthijs wrote:First question is: why do you need target blank? There is a reason it's depracated
Because it is the easiest (and only) way I know how to open links in a new window using pure html. I would like to have the same functionality without using target, but I don't really want to require javascript.


Also, I've found that charset "ISO-8859-1" displays all my special characters perfectly.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Charsets && external links

Post by matthijs »

I understand that it's for opening new windows. The reason I asked is: why would you want to do that? There can be valid reasons, but there many invalid reasons as well.

And the fact remains: if you need target blank: just use a transitional doctype. Those transitional doctypes were invented for that reason.
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Re: Charsets && external links

Post by Chalks »

matthijs wrote:I understand that it's for opening new windows. The reason I asked is: why would you want to do that? There can be valid reasons, but there many invalid reasons as well.
because the link(s) are on pages that if/when you navigate away from them, you lose your place in the js array. The js array keeps track of which words you translated correctly or not, it is also generated by filling in a form on the previous page (i.e. test all verbs from chapter 4). Also, when I'm sending people to other websites I like them to know that it is happening. When I'm sending them to internal pages, I like that to happen without opening a new window. In other words, all external links -> new window, all internal links -> same window.
matthijs wrote:And the fact remains: if you need target blank: just use a transitional doctype. Those transitional doctypes were invented for that reason.
but I LIKE the strict dtd. Besides, it feels like the simple and useful 'target blank' was replaced with 'hahah, screw you!' and that's something I'd like to know how to remedy.


To tell the truth, it doesn't _really_ make a difference whether I have it open in a new window or not on this particular website since I only actually have 1 external link (it's a small site). However, I would find it very aggravating to have to go through this again for a larger website, and I just want to get a solution now, so that I don't have to solve it again 3 months down the road.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Charsets && external links

Post by matthijs »

Chalks wrote:The js array keeps track of which words you translated correctly or not, it is also generated by filling in a form on the previous page (i.e. test all verbs from chapter 4).
You could use sessions to keep track of stuff.
Chalks wrote: Also, when I'm sending people to other websites I like them to know that it is happening. When I'm sending them to internal pages, I like that to happen without opening a new window. In other words, all external links -> new window, all internal links -> same window.
I don't understand your reasoning. I'm on a webpage and see a link. I click on it and I'm taken to a new page. Then I'm very well aware of the fact that I've gone to a new page. Also, I don't see how opening a new window helps with that.
For some users it might only be confusing. They click a link, get to the new page. Then at some point they want to go back, so they click the back-button in their browser. Oops! Doesn't work anymore.
Chalks wrote:but I LIKE the strict dtd. Besides, it feels like the simple and useful 'target blank' was replaced with 'hahah, screw you!' and that's something I'd like to know how to remedy.
Why do you like the strict doctype if you want to use transitional stuff? I don't think anybody tried to "haha screw you" with the removal of the target blank. The reason was that opening windows is functionality belonging to the browser. It's behavior, not belonging in the markup of the document. Also don't forget that there can be accessibility problems for some screenreaders when you open new windows.
Chalks wrote: To tell the truth, it doesn't _really_ make a difference whether I have it open in a new window or not on this particular website since I only actually have 1 external link (it's a small site). However, I would find it very aggravating to have to go through this again for a larger website, and I just want to get a solution now, so that I don't have to solve it again 3 months down the road.
A good read about this is http://domscripting.com/book/sample/
There's even a nice unobtrusive javascript solution for opening new windows at the end of that article.
Post Reply