Forum Moderators: open
[webmasterworld.com...]
I think "_new" is not a reserved keyword, it just opens a window with the name "_new" while "_blank" creates a new browser window from the scratch.
globay: thanks, read it. but they didn't come up with a alternative...
So this is my solution for the time being:
<* line break added to prevent side scroll>
<script type="text/javascript">
//<![CDATA[
<!-- Script Start
var win=null;
function newwindow(mypage,myname,w,h)
{
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',
*scrollbars=0,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}
// Script End -->
//]]>
</script>
while the link looks like:
<a href="link.htm" onclick="newwindow('link.htm','Loading',xxxxx,yyyyy);return false;"> ......
...which also deals with Non-Javascript-Browsers. Can anyone confirm this is appropriate xhtml-handling?
[edited by: tedster at 9:51 pm (utc) on May 14, 2003]
"[...] A number of other standards-compliant new-window link scripts out there propose using window.open() to load the document in a new window. While this approach generally works well on the surface, its downfall is that most browsers do not correctly report the referring URL in the request for the new page, which can be a serious issue, especially in inter-site links. [...]"
What do they mean by it doesn't correctly report the referring url?
"hey, we can do the latest technolgy"
but that doesn't mean coding for browsers that can't display it properly ;)
What do they mean by it doesn't correctly report the referring url?
If the target page runs some sort of script that relies on getting a proper HTTP_REFERRER header (to deliver certain content depending on the page you were browsing when you clicked the link)... then window.open() simply won't work.
Personally I begin to like the "strict"ness of xhtml 1.1 since it's finally a complete and cleaaan system and set of rules without any "transitional" variants :-).
For the new window, this thing is only used to popup a larger view of all the IMGs on the page. Sounds to me like window.open() should be enough (also I can adjust the width and height to the image size).
window.open("http://www.mysite.com/somepage.html", pragma);
I'm using xhtml 1.1 simply because it's a promotion website for a webdesigner - to sort of show "hey, we can do the latest technolgy" :-)
I can see the point of this argument, however I have a few caveats. Firstly, if you want to really show what you can do with XHTML 1.1, then aren't you doing yourself a disservice by resorting to massive hacks like those I described above? I mean, you are just putting the spotlight on one of the limitations inherent in using XHTML 1.1.
Secondly, if you are determined to go for 1.1, then you should seriously consider going the whole distance by serving the pages with the mime-type of
application/xml+xhtml to those browsers which can cope (principally Mozilla). Beware that if you do that, you can't slip up on the "well-formedness" of your markup, and you may well have to adapt your CSS and Javascript too. Personally, I use HTML 4.01 Strict for commercial sites, and keep the XHTML for just the experimental stuff. Oh, and I hate it when links open in new windows! :D
univ:
Do you really see this little script as a massive hack? I mean this all happens within all the regulations and recommendations. And by using <a href="link.htm" onclick="newwindow('link.htm','Loading',xxxxx,yyyyy);return false;"> I also cover people without javascripting active...
Hm see it this way... all the thumbnails on the webpage need to be zoomed to show details. This is - without script - happending in a regular Back-available history-style or - when clienscripting is active, which relates to the browser-technique/environment, in a small popup (ANY click will close it).
I hate popups too and - hereby - I promise to never use it - also when leaving the site - except for this image-popup. :-)) What would you suggest for a webgui handling if you had thumbnails on a page and want to provide a clean AND easy way to allow the visitor to see a larger image?
What do you mean with the mime-type 'application/xml+xhtml'? Is defining the doctype not enough? Markup and CSS are optimized already and pass the validator with no problems. (I started upgrading xhtml only several weeks ago, so I apologize for 'newbie'-questions...) I am also not using any propriatery CSS and ANY other javascript (except this popup).
>> Personally, I use HTML 4.01 Strict for commercial sites, and keep the XHTML for just the experimental stuff. Oh, and I hate it when links open in new windows! :D
My way as well, except with some customers here I need to stick to transitional. The idea of using xhtml 1.1 for the promotion site was to kick customers in the butt and say "hey, did you actually know there is a standard out there? and some development? And what b***sh** you get from so many web developers?"
rain:
Thanks, will take that into account. :-)
What do you mean with the mime-type 'application/xml+xhtml'? Is defining the doctype not enough?
(OT reply: to quote, use (quote) and (/quote), except with square brackets!)
Sorry to reply with just a bunch of links, but this is a complex matter and others express it better than me.
This article is the best I've found so far which explains MIME types:
[xml.com...]
You might also want to read this opinion about the issue:
[hixie.ch...]
I am not completely averse to XHTML, but a lot of people using it are simply jumping on the bandwagon, rather than making good use of it. There is a lot more to XHTML adding a few trailing slashes and changing the
DOCTYPE! I think your Javascript solution sounds very reasonable - when I was talking about a "massive hack", I was referring to my previous suggestion regarding creating a new DTD just to add the target attribute.
Yes, this DTD extension had a little too much overhead for me for just popping some picture zooms :-)
This bringes up new challenges; if your web hoster doesn't allow shell access in the way to cusomize your mime types, you will never be able to publish xhtml code?
You don't need shell access, but you do need Apache mod_rewrite or a server-side scripting language. The first article in my previous post gives the code in PHP and Python, and it should be trivial to do the same in ASP or perl.
Hm, tried both the php script and the .htaccess rewrites, but the xt w3c validator still shows text/html... :-(
I'm not aware that the validator sends an accept header for
application/xml+xhtml, so it would naturally still show the output as text/html. To check, you just need to look in Mozilla (or Netscape 7). Go to View > Page Info (Ctrl+I). You should see "Type: application/xml+xhtml" and "Render Mode: Standards Compliance Mode". Don't forget, the script and rewrites only send the MIME type application/xml+xhtml to user agents which can cope with it, sending the MIME type text/html to everything else.
Interesting reader comments are linked to that article. One of them refers to a german article
[schneegans.de...]
which really seems to bring it to the point. Right now it seems not recommendable to do anything in xhtml, since 95% of the used browsers misinterpret the intended xhtml semantic (wether it's the wrong mimetype or stupid bugs).... That's a lot to think about; maybe try xhtml again next year?! :-)
Right now it seems not recommendable to do anything in xhtml ...(snip)... That's a lot to think about; maybe try xhtml again next year?! :-)
I can't comment on the article you mention as my German is, erm... limited. You have a legitimate desire to use XHTML (as a way of showcasing the new standard) and you should be able to do so with care. I wouldn't give up just yet!
As I mentioned earlier, I don't use XHTML for commercial sites, and I don't expect to do so for a couple of years yet. However, that doesn't mean that you shouldn't, as long as you are careful. The problem with XHTML is from those sites that treat it as merely as a drop-in replacement for HTML 4, with a few trailing slashes and a namespace declaration. Being aware of and attempting to deal with issues such as the MIME type problem means that you are not likely to create the myriad of problems mentioned in the previous articles.
I admit to being a standards geek, and I use CSS and table-free layouts extensively, but I find that XHTML offers no immediate benefits and have many pitfalls, and is a bandwagon I'm not going to jump on for the moment.