473,237 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

javascript outside of <html> tags

Hi everyone,

Is it possible to place javascript outside of <html> tags? I'm trying
it on mozilla atm, and it seems to be working, but I was more worried
about the older browsers.

Cheers

Taras

Dec 19 '05 #1
2 2066

ta******@gmail.com wrote:
Is it possible to place javascript outside of <html> tags? I'm trying
it on mozilla atm, and it seems to be working, but I was more worried
about the older browsers.


Well Firefox 1.5 for instance supports SVG and script and there you
could certainly place script inside of an SVG document "completely
outside of any HTML elements".

If you want to write HTML tag soup ignoring specified HTML standards
respectively DTDs then you can do that if you serve the contents as
text/html, browsers usually try to make sense of that with their "tag
soup" parsers but results can vary. In the end the browser (at least the
modern one) has to built a document object model where the document node
has to have exactly one element child node, the html element node, and
all other element nodes have to be descendants of that html element
node. So any tag soup alike e.g.

<script>
document.write('<p>Kibology for all.');
</script>
<html>
<head>
<title>example</title>
</head>
<body>
</body>
</html>

forces the browser to guess where to place the script element and the p
element it writes in the DOM tree.

But text/html has a long history being used for tag soup and browsers
(older and newer) usually deal with that without complaints.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 19 '05 #2
ta******@gmail.com wrote:
Is it possible to place javascript outside of <html> tags?
Script code does not need to be placed within a HTML document, if
you mean that.

The `script' element must be child of the `head' or `body' element,
hence the `html' element must be its ancestor (its grandparent, if
you will), if you mean that.
I'm trying it on mozilla atm, ^^^
Is that

,-[FOLDOC]
|
| 3. <chat> At the moment.

?

Otherwise, please explain.
and it seems to be working, but I was more worried about
the older browsers.


It is not a question of "older browsers", it is a question
of interoperable code, which non-Valid markup is not.

<URL:http://validator.w3.org/>
PointedEars
Dec 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: josh dismukes | last post by:
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start ();
5
by: Ben | last post by:
hi all, just wondering if it is possible to call a function that resides on external php file before any <html> tag?? i have a code that sets a cookie which needs to be called before <html> tag....
9
by: Philip TAYLOR | last post by:
Configuring a new instance of IIS, I noticed that it allows an HTML-formatted document trailer to be appended to every document served. Unfortunately, on checking its behaviour, I find that it...
10
by: Kathy Burke | last post by:
Hi, in trying to discover why my RegisterStartUpScript wouldn't work (I do NOT see it in the HTML source), I looked at the HTML source of a page where I do an XslTransform. First, I get the...
4
by: Mark G. | last post by:
Hello. I am attempting to write a "scraper" to download information from a commercial web site. Oddly enough, they don't want to make this easy for me! Their pages include plenty of Javascript,...
1
by: yawnmoth | last post by:
I'm trying to mess around with PHP5's DOM functions and have run into something that confuses me: <?php $dom = new DOMDocument(); $dom->loadHTML('<html></html>'); echo...
1
by: John | last post by:
Hi var poster="<html><head..... etc .... </html>"; var animal='dog'; The string contains images and text that changes. Originally I wanted to do something like print "<a href=" +...
3
by: Silmaril | last post by:
hi everyone, i have a question about place of metatags. i've started to seo for active webpage of our client(which is not coded by me) ,but website is very bad coded then i'm a lazy programmer...
3
by: gaya3 | last post by:
Hi, can anyone please say me how to add <html> tags inside JTextarea? Thanks in Advance. -Thanks & Regards, Hamsa
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.