May 16, 2008

Opening Hyperlink In New Window Using Xhtml 1.0 Strict

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Opening Hyperlink In New Window Using Xhtml 1.0 Strict

csp4.0
My website (currently under construction) is all going well until I realized that the XHTML 1.0 Strict DTD does not allow the target="_blank" attribute. How would I find a way around this? I'm used to using XHTML 1.0 Transitional, but I want this website to be Strict for a change.
I would really like it if someone here at trap17 can give me some css that allows them to be opened in a new window.

I have searched on Google and only found ways that include writing my own DTD (which I don't want to do), use javascript, and use another doctype.
All of those things, I don't want to use. So it would really help if there is any way at all to open up a new window using CSS.

Reply

jlhaslip
Nope, can't be done via CSS with an XHTML Doctype.

Javascript would be the recommended method, but consider that the rule against opening up new windows is there for a reason. Let the client decide which windows (tabs) get opened in a browser... that is the intent of the restriction in XHTML.

Reply

rvalkass
In this era of tabbed browsing, different browsers take different understandings to being asked to open a link in a new window. Some take this literally, and so open an entire new browser window, while others take the logical route of opening a new tab. Then there is the possibility that the person viewing your site has ad-blocking or popup-blocking software running. They may well automatically prevent your link from opening a new window. As you can't necessarily be sure what will happen, it is best to go with something that will work instead. Let the browser and user decide what to do. Leave your link with no target, then the user can decide to open a new tab or window if they want, or to open the link in the existing tab/window.

Reply

bthaxor
i think in this case, the only method is to use javascript.

i don't understand why you don't want to use javascript - javascript has got to be my favourite web-designing language, since you can do almost anything with javascript (if you really tried, and used document.write a lot, you could even (try to) design a whole webpage with javascript!).

i just found a handy code that i used to use (used to because i don't care about validation anymore - all i care about is if it works in all browsers, since my document comes up with 100 errors anyway. i prefer to stick to ' target ="_blank" '). it is javascript, cross-browser and works 100%:

CODE
addLoadEvent(externalLinks);

function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
    }
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


then, all you have to add to your links is ' rel="external" '. an example:

CODE
<a href="somepage.html" rel="external" title="this page opens in a new window">new window link</a>


hope i helped.

 

 

 


Reply

csp4.0
The reason I don't want to use javascript is the fact that I am using a redirection service (www.freedomain.co.nr) and it requires that I put a picture linking back. I can't modify the code so that is why I want a CSS code that opens the normal anchor tags in a new window and manually putting the nostyle tags in the ones I don't want to open to a new window.

But now that I think about it. There doesn't look like a way to do it in the original way, so I guess that the javascript way is the only way. Or I might just 'cheat' and write my own DTD... hehe happy.gif

Reply

Liam_CF
Instead of .co.nr you can use .uni.cc which works.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. xhtml hyperlink pop up information - 530.15 hr back.
  2. hyperlinks to a new window in xhtml strict - 796.00 hr back.
  3. hyperlinks in xhtml strict - 796.18 hr back.
  4. rel="external" xhtml strict - 927.15 hr back.
  5. xhtml 1.0 strict new window - 1013.16 hr back.
  6. how do i get hyperlinks to open up in a new window using xhtml 1.0 strict? - 1047.81 hr back.
  7. window.onload xhtml 1.1 - 1248.43 hr back.
Similar Topics

Keywords : opening, hyperlink, window, xhtml, 1, 0, strict

  1. Xhtml Strict Links Tip
    A problem might accure (5)
  2. Questions About Xml, Xhtml
    (3)
    Hi, I like to know briefly about XML , XHTML and can be they be in replacement of MYSQL/MYSQL for
    data storage?....
  3. Create A Xhtml, Css3 Valid Gallery With Javascript ;part 1
    (0)
    What were making In this tutorial, we will be creating a web page that can be used for a gallery, an
    easy way of showing your portfolio of works or photography, etc. The page will be coded in XHTML
    1.0 Strict and CSS3 valid, our CSS won't even have any warnings on them apart from one. So the
    first thing we need to do is set up a base structure for the XHTML. Below is the code for this.
    HTML html xmlns =" http://www.w3.org/1999/xhtml "> head > meta http-equiv ="
    Content-Type " content=" text/html; charset=iso-8859-1 " /> title >XHTML & CSS Galler....
  4. Wml / Xhtml ?
    for wap (6)
    wml/xhtml who gvs more facilities to make a wap-community site?....
  5. Need Free Help With Upgrading Websites For Church
    Must be versed in XHTML and CSS (4)
    I recently helped a Father Andreas of the Ukrainian Orthodox Church in Denver revamp his
    websites. He was happy enough that he passed on the information about my help to a friend. I have
    received this e-mail, but I am unable to do much since I am not educated in XHTML and only know
    basic CSS (still learning). QUOTE I want to update my websites from HTML with tables to XHTML
    with Style Sheets. All of my websites are for my Church, the Hellenic Orthodox Traditional Church.
    Would you be able to assist me with this project? In Christ! Symeon of Denver If....
  6. Embed Tag Valid In Xhtml 1.0 Strict?
    (2)
    Is it? If not, could anyone reccommend how to get round it?....
  7. Xhtml Strict Method For Submit/reset Buttons As An
    (1)
    What's the proper way to handle submit and reset buttons? Using type submit and reset don't
    allow you to replace the default button with an image, using the type image doesn't allow a
    button to automatically act like a submit or reset....so far as I know. So How should I do this
    when I want to use a custom image as the button? Code will be best way to explain, thanks! ....
  8. Encoding And Xhtml Requirements
    (2)
    OK, so after reading a lot of contradicting information I decided to ask. How should document
    encoding be announced? The W3C validator (or at least links from the same upon a missing encoding)
    suggests the server should send the encoding in the content-type header. The problem with this that
    I see is that you can't always make a blanket judgment about what encoding pages will be in. Is
    it simply suggested to use .htaccess files (or equivalent) for this, then? I am led to believe that
    most (all?) browsers will ignore a content-type meta tag. Is there another in-file o....
  9. Modify The Invision Skin Standards
    about the xhtml (1)
    and hi, i just used the ipb1.3final.yeah.my skin is caliskinV6,got that from here ,since the cali3D
    won't realease the new skin for IPB1.3 i just wanna to know if this is impossible,--modified the
    skin to xhtml 1.0 or 1.1 standards. and you know the default skin of ipb is a comptnet,and the
    Adding skin like CaliskinV6 is another comptnent,they are the different system,so i think there
    would be the way to make the templates to xhtml stict. thank you,guangdian.....
  10. What Is Xhtml
    What Is It And Why Use It? (27)
    I was wondering what XHTML is because I have seen alot of sites that claim to be XHTML validated
    rather than HTML validated. How does this compare to HTML? Why is it better? How hard is it to
    master? How similar is it to HTML? Thank you for answering my questions! You should know by
    now that What Is...? section is not to post question. Moving. Warning issued. ....
  11. Strict Xhtml
    target atribute (4)
    I have ran into this issue; Strict XHTML 1.0 does not support target atribute... so what should i
    do? How will i use _blank pages with my stuff?....
  12. Xhtml 1.1 Vs Xhtml 1.0
    Whats the difference? (13)
    Is it only one type of xhtml 1.1 versus the three different types of xhtml 1.0 (strict,
    transitional-loose, and frameset)? Is it 1.1 only strict? What are the differences or whats this
    all about? I have heard something about xhtml 1.1 but have not actually seen one (not that i know at
    least)... Thanks!....
  13. Xhtml Forms Layout
    all within the standars (8)
    We all remember the good old tables right? When we used them to design or beloved websites. But
    nowadays things have change a little bit, strict code format, css, xhtml and no tables. And so
    when it comes finally to the design of a form, instead of having two rows (left row with the label
    and right row with the input tag) and those rows aligned to look nice (left row= right aligned and
    right row=left aligned), how can we keep order with our fancy style sheet? Thanks in advance.....
  14. Xhtml Dtd
    can you set it up? (5)
    Can you set up the document type definition in order to create your own tags in XHTML? (Just as it
    happens with XML). I have been learning XML and DTD, and as i actually DO find it useful, i think
    its even more useful the fact that a language (like HTML) already strongly accepted, has its own
    structures defined. Its just sometimes you need to add a little adjustment here and there. So i
    ask if theres a way to define this in XHTML, your structures of tags and attributes and all that. I
    already know a coupple of sites which teach xhtml, but just have not found what i wa....
  15. Order With Xhtml And Css
    how do i improve (10)
    hi!, actually i'm working on one site for my grandma's vivarium, i have been researching
    all kinds of features about xhtml and css and it rocks, but i have got a lot of problems with the
    arrangement, alignement and possitioning, specially when the content of tables differs and i have to
    create a new class, and then i have to reorder all the padding, marging, width and heights commands
    or even worse, nesting!. I lose the control of the layout. ok the question here is if there is
    any way of doing standard tables(with divs) of content or layouts structures,....
  16. What Is The Xhtml 1.1 Code To Embed An Applet?
    (2)
    I've been doing a lot of java stuff recently and some is pretty neat, so I'd like to put it
    on the internet. I'm using XHTML 1.1 for all my pages, though, and according to W3Schools
    doesn't exist anymore and to use object. It's not working, though. There are a bunch of
    attributes ( http://www.w3schools.com/tags/tag_object.asp ) and I have no idea which things I need
    to use. Which do I put for an applet?....
  17. Opening Images In Pictureviewer Instead Of Browser
    Locally (7)
    What I am trying to do is make up a small HTML site which will be based localy on my computer and
    basicly show all of the images I have taken on different holidays. What I want though is when I
    click on an image for it to be opened up in Windows Picture Viewer. As the web site will all be
    saved locally on my computer and not be going on the internet is there any way of achiving this? I
    am running Windows XP Professional if it makes any difference Thank you in advance,kvarnerexpress....
  18. Xhtml Concerns
    just wondering (6)
    i been reading about it i got somewhat an understanding of it but how can you clearly define as
    xhtml when all it really is a html redefined to the point that its just trimmed down and little bit
    added here and there or its just the lack of understanding of it that confuses me. well of course
    im wondering if anyone is using xhtml or still using html or a combo of both? of course i need some
    more info w3c don't help out much.....
  19. Html And Xhtml
    serving the right kind (11)
    Right now I have a site, which I've made XHTML 1.0 Strict. I am sending it as
    application/xhtml+xml to browsers that say they can handle it, and as text/html to all other
    browsers. Anyway, I started thinking that I'd much rather send proper HTML 4.01 to browsers that
    don't understand XHTML instead of XHTML pretending to be HTML 4.01. It's not really a
    problem with IE, because it is made to handle badly written sites, but who knows, some browser that
    can handle HTML, but not XHTML, may be (correctly) parsing CODE <p> Hello <br />
    World....
  20. Wha's The Difference Between Xhtml 1.0 And 1.1?
    (2)
    i learned xhtml 1.0 from w3 schools, but that was 1.0. what's new in 1.1? thanks in advance....

    1. Looking for opening, hyperlink, window, xhtml, 1, 0, strict

Searching Video's for opening, hyperlink, window, xhtml, 1, 0, strict
advertisement



Opening Hyperlink In New Window Using Xhtml 1.0 Strict



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE