How to use html4 or lower version in eclipse mars? - eclipse

I am new to Eclipse and my eclipse supports html5 by default and whenever i use tag which are outdated in html5, i get an error so please help me out how to use html4 or lower version instead of html5.

To tell the broswer you are using HTML4 documents you need to set the doctype like this in your index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
You have different DOCTYPE declarations here.

Related

How to prevent Perl CGI->start_html() from printing DOCTYPE header

when using Perl CGI, it always print out the: <"DOCTYPE html ".... > header before printing out the rest of the html body, which messes up the proper display of the web page. I guess the cause is the DOCTYPE still references a very old version of HTML. This first line get generated regardless when I use $query->start_html(...);. So the question is, how to prevent that <!DOCTYPE...> line from being generated? When I delete that DOCTYPE line, my web page runs properly after that. Any insight is greatly appreciated. Thanks!
Browsers will use the DOCTYPE definition to decide whether or not to interpret an HTML (or XHTML) document in Quirks mode. I assume that's what you mean by "messes up the proper display of the web page" - you're carefully creating valid HTML5 but the browser goes into Quirks mode and the page doesn't look right.
What you want is the standard HTML DOCTYPE definition.
<!DOCTYPE html>
Unfortunately for you, the HTML generation functions in CGI.pm are unmaintained and don't have support for HTML5. So you can't get the module to generate this DOCTYPE.
Honestly, your best approach is to stop using all of the HTML generation functions and switch to a template-based approach instead. But I can see how that would be a big job so, in the short term, perhaps you can just stop using start_html(). It shouldn't be too hard to replace the call with a heredoc that contains the text that you want.
Update: The comment from Quentin below got me thinking. When I said:
you're carefully creating valid HTML5 but the browser goes into Quirks mode and the page doesn't look right
I was completely wrong. If you get the browser behaviour you want without a DOCTYPE, then you want to put the browser into Quirks mode. And that's far easier. Using the information from the Wikipedia article I linked to above, you can see that HTML 4.01 Transitional is the most recent DOCTYPE that will put all modern browsers into Quirks mode. So you can use that DOCTYPE.
$ perl -MCGI=:html -E'say start_html(-dtd => "-//W3C//DTD HTML 4.01 Transitional//EN")'
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Untitled Document</title>
</head>
<body>
And that should get the browsers working as you want them.
But relying on Quirks mode is fragile. I recommend that you consider fixing your HTML and CSS so that they work as you want when browsers are in Standards mode.

TinyMCE editor is not loading because document is not in standards mode - how can I get my document in standards mode?

I am so close to getting the TinyMCE editor to work at our site. The necessary scripts when adding a discussion are loading.I can see them in the HTML source. And my domain is properly registered for the API key I'm using. And the id/name of the textarea is correct. But the editor itself doesn't load for the textarea.
There is just one JavaScript console error:
Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode.
Does anybody know what "standards mode" is and how I can make sure the page served is in standards mode?
A big never mind. I found the solution. The document was in so-called "quirks" mode because there was no DOCTYPE. I added this on top and the editor worked just fine!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Even later I discovered something that might help.
Check if the first tag is of the <!doctype html>.
In my case a tag was taking the first place.

Code Completion Plugin for Struts in Eclipse

I've moved on from JSF to Struts in order to get a more rounded understanding of the two frameworks. In JSF when I created an XHTML file and inserted the necessary JSF tag libraries, like so:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
I was able to get code completion. For example - it could tell me what variables were readable/writable from that particular class attached to that bean - helpful when you think you have correctly created them but haven't. I was wondering if Struts has an equivalent?
For example, in my login screen I have the following:
<ul>
<li>first example</li>
</ul>
Is there a library or plugin that could be added that would automatically complete this if necessary.
Cheers
put this on the head of your page:
<%# taglib prefix="s" uri="/struts-tags"%>
Here is the reference for all tag Tag Reference
Btw. Welcome to Struts2.

Fancybox shifts to the right and down a few pixels after loading

I'm using Fancybox to open an iframe and it works fine in all browsers except for ie.
When ie opens the iframe it seems to stagger for a split second and then it shifts the modal box to the right and down a few pixels.
I came across a few people's posts but their answers didn't help.
I also played around with the CSS with no success.
Anyone came across anything like this before?
Cheers!
Hope my solution will help to anyone who still face the same issue...
I use fancybox 1.x and my DOCTYPE is "html".
I've found that actually the issue was in using box-sizing: border-box; in styles reset. So I switched it back to content-box for #fancybox-content and #fancybox-wrap and fancybox started to work properly.
Fancybox needs a proper DOCTYPE to work correctly, specially with IE. Your site is currently running in quirks mode.
You can find a working DOCTYPE reference here.
by this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
In your particular case, you may try changing this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Fancybox needs a proper DOCTYPE to work correctly, specially with IE. Your site is currently running in quirks mode.
You can find a working DOCTYPE reference here.
In your particular case, you may try changing this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
by this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
UPDATE : I have created some simple html pages to reproduce the issue with IE.
The first one uses the same DOCTYPE as in your page as well as the same fancybox code. IE works in quirks mode so fancybox behaves oddly as in your page:
http://picssel.com/playground/jquery/ieWrongDoctype_09feb12.html
The second one uses the proposed DOCTYPE as solution. IE works in standards mode and fancybox works properly:
http://picssel.com/playground/jquery/ieGoodDoctype_09feb12.html
My conclusion: use the correct DOCTYPE

Warnings of valid HTML5 attributes in Eclipse

I use Eclipse and I write jsp files with HTML5 content.
So I have for example this line:
<div class="test" data-role="test123">
In Eclipse I get the warning:
Undefined attribute name (data-role)
What needed to be done so these warnings won't appear anymore? In HTML5 this attribute is allowed (data-*) as you can see here: http://ejohn.org/blog/html-5-data-attributes/
It seems like Eclipse still has some problems validating HTML5 elements and attributes even now.
I'm running Mars 4.5.1 and I have had warnings about the <main> element, despite the fact that there are no warnings about the <section> element.
But there is a solution!
Window > Preferences > Web > HTML Files > Validation
Here you can tick the Ignore specified element names in validation checkbox and enter the names of any elements which Eclipse is incorrectly warning you about.
In your case, you will want to tick the Ignore specified attribute names in validation checkbox and enter the data-role attribute.
After you click 'Apply', Eclipse will ask you to do a full validation of the project. Select 'Yes' and the changes will take effect.
No more squiggly yellow lines YAY! :D
Your doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
is for HTML 4.01.
data-* attributes were added in HTML 5. The doctype for HTML 5 is basically either
<!DOCTYPE html SYSTEM "about:legacy-compat">
or
<!DOCTYPE html>
Newer versions of Eclipse support HTML5 tags and the data-* attributes allowed in HTML5. However, when using the role attribute the proper syntax according to the ARIA Roles Model and XHTML Role Attribute Module is not to prefix the role attribute with data-* leaving just role and not data-role.
So <ul role="menubar"> is more correct than <ul data-role="menubar">. The validity of the syntax can be checked using the (X)HTML5 Validator. jQuery Mobile uses quite extensively the data-role attribute, though I'm not sure why.
Note: If you upgrade and you're still getting warnings on data-* attributes you may want to consider updating or removing any installed syntax-checkers such as JTidy. As of Indigo Service Release 1 the role attribute continues to trigger an undefined attribute warning in Eclipse by default.
I used this one with Aptana 3.6 when I'am coding AngularJS
Window > Preferences
I use the Aptana Studio plugin on Mac OS X; if I go Eclipse > Preferences > Aptana Studio > Validation > HTML, and create the filter *data-role* I no longer get this warning.
I believe on Windows it is Window > Preferences > Aptana Studio > Validation > HTML
Eclipse 3.6 introduced a new field under:
Validation -> HTML Syntax: Ignore specified attribute names in validation
Add the OpenGraph, RDFa or other non-HTML5 attributes you want the validator to ignore:
You will need to re-validate the project, then the warnings will be gone.
Eclipse observes the DOCTYPE declaration. In my case, the solution was using the code above at the first line of the files containing HTML code:
<!DOCTYPE html>
Related to that, there's this other question, already answered:
Why do we need DOCTYPE to the HTML/JSP pages?