473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SCRIPT tag

I'm having some trouble with my script tag. I'm trying to include a
piece of PHP text via the script tag by doing so:

<script src="http://pinata.no-ip.org/~altmarvel/Scripts.php"></script>

This produces nothing, but I don't know why. I've even gone so far as
to make it as simple as putting a simple HTML string inside
Scripts.php, which it refuses to print out. Yet, this refuses to print
anything out.

I've gotten some sample code from some 80s toy site, and the string
they use which works is:

<script src="http://www.seibertron.com/news/include_news.php"></script>

I have no clue what the difference between these two strings is, and
it's infuriating. Does anybody know? Is there a PHP switch or
something?
Jul 20 '05 #1
14 3380
li***************@yahoo.com (Liam Gibbs) wrote:
I'm having some trouble with my script tag. I'm trying to include a
piece of PHP text via the script tag by doing so:

<script src="http://pinata.no-ip.org/~altmarvel/Scripts.php"></script>

This produces nothing, but I don't know why.
Browsers don't ordinarily know how to execute PHP. Even if they did,
you would have to *tell* them that the script is going to be PHP by
using the SCRIPT tag's TYPE attribute. If you're using a browser that
doesn't disqualify the SCRIPT tag altogether for omitting the required
TYPE attribute, it expects Javascript when no type is given
explicitly.
I've even gone so far as
to make it as simple as putting a simple HTML string inside
Scripts.php, which it refuses to print out. Yet, this refuses to print
anything out.

I've gotten some sample code from some 80s toy site, and the string
they use which works is:

<script src="http://www.seibertron.com/news/include_news.php"></script>


What site? URL?
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #2
Liam Gibbs wrote:
I'm having some trouble with my script tag. I'm trying to include a
piece of PHP text via the script tag by doing so:

<script src="http://pinata.no-ip.org/~altmarvel/Scripts.php"></script>
PHP is a server-side language interpreter.
I suppose you could try giving a "type" value, something like
type="text/php".

I have no clue what the difference between these two strings is, and
it's infuriating. Does anybody know? Is there a PHP switch or
something?

Do you know what PHP is?

--
jmm dash list at sohnen-moe dot com
(Remove .TRSPAMTR for email)
Jul 20 '05 #3
Liam Gibbs wrote:
I'm having some trouble with my script tag. I'm trying to include a
piece of PHP text via the script tag by doing so:

<script src="http://pinata.no-ip.org/~altmarvel/Scripts.php"></script>


You appear not to know what PHP is.

http://www.php.net/tut.php
http://www.php.net/manual/en/

--
Mark.
Jul 20 '05 #4
Liam Gibbs wrote:
<snip>
<script
src="http://pinata.no-ip.org/~altmarvel/Scripts.php"></script> <snip> <script
src="http://www.seibertron.com/news/include_news.php"></script>


If you enter:-

view-source:http://pinata.no-ip.org/~altmarvel/Scripts.php

- and:-

view-source:http://www.seibertron.com/news/include_news.php

- into the location/address bar of a web browser to view the material
actually being sent to the browser you will find that the first is
returning a fragment of HTML, while the second is returning valid
javascript source code.

The second works because the browser's javascript interpreter is able to
understand and execute javascript source code, while its interpretation
of an HTML fragment will be as a series of javascript syntax errors, and
it will terminate its attempt to execute the script at the first it
encounters.

Richard.
Jul 20 '05 #5
"Liam Gibbs" <li***************@yahoo.com> a écrit dans le message de
news:62**************************@posting.google.c om
I'm having some trouble with my script tag. I'm trying to include a
piece of PHP text via the script tag by doing so:

<script src="http://pinata.no-ip.org/~altmarvel/Scripts.php"></script>

This produces nothing, but I don't know why.


What are your exacts needs ?
If you want to include text produce by another web page, then <script
src...> is one of the solutions. Please read the recent thread
"Templates/inclusion in the new age" :

http://www.google.fr/groups?hl=fr&lr...com%26rnum%3D1

If you choose to use script, then your php page should send to the browser
correct mime type and javascript code (document.write(...) )

Jul 20 '05 #6
Pierre Goiffon wrote:
<snip>
... , then your php page should send to the
browser correct mime type and javascript code
(document.write(...) )


There is no correct mime type for client-side javascript source.
Browsers appear to ignore content type headers sent in the context of
script elements.

Richard.
Jul 20 '05 #7
li***************@yahoo.com (Liam Gibbs) wrote in message news:<62**************************@posting.google. com>...
I'm having some trouble with my script tag.


You're unclear about the differences between server-side and
client-side scripting.

PHP is server-side only. <script> is client-side only.

_If_ your PHP code's function is to _make_ a client-side script
(sometimes called "meta-scripting"), then you might have a client-side
<script> that refers to a piece of server-side PHP. But what the
<script> element is referring to is the _output_ of the PHP script,
not its source code.
Jul 20 '05 #8
In article <28*************************@posting.google.com> ,
di*****@codesmiths.com enlightened us with...
li***************@yahoo.com (Liam Gibbs) wrote in message news:<62**************************@posting.google. com>...
I'm having some trouble with my script tag.


You're unclear about the differences between server-side and
client-side scripting.

PHP is server-side only. <script> is client-side only.


Well, there _is_ a
<script runat="server">
for ASP.
--
--
~kaeli~
Acupuncture is a jab well done.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #9
Ahhh.... I'm starting to see now. I was familiar with PHP, but not
with the SCRIPT tag. What I thought it would do is run the PHP on my
server, my server would spit the output to that page, and.... then a
whole bunch of stuff I was unclear about. I guess I have more muddling
to do now with JavaScript and so forth.

And I was unaware of the view-source thing. I'll also try that type
value.

Thanks all!
Jul 20 '05 #10
On Tue, 8 Jun 2004 13:04:06 -0500, kaeli <ti******@NOSPAM.comcast.net>
wrote:
Well, there _is_ a
<script runat="server">
for ASP.


I was hoping no-one would mention that - let's not confuse the poor
guy, OK ?

Jul 20 '05 #11
"Richard Cornford" <Ri*****@litotes.demon.co.uk> a écrit dans le
message de news:ca*******************@news.demon.co.uk
There is no correct mime type for client-side javascript source.
Browsers appear to ignore content type headers sent in the context of
script elements.


Yes, it seems there are not any "official" mime type meant to serve
JavaScript. But are you sure any mime type would fit in any browser ? I was
unclear about that, but unfortunatly haven't got enough time to test
yesterday evening.

In fact in a previous job we used JavaScript for external inclusion, these
JavaScript source were generated through ASP pages. As far as I can remember
we choosed to send something like application/x-javascript because some
browsers (probably NS4) absolutly wanted something different from the
default ASP text/html.
Her, I guess I'll test this evening...

Jul 20 '05 #12
James Moe wrote:
PHP is a server-side language interpreter.
I suppose you could try giving a "type" value, something like
type="text/php".


The type should match the MIME type of the scripting language used.
Whether the client-side scripting code (most probably Javascript code)
is a static file with a .js extension, or generated by PHP script on the
server, should not and does not matter to the browser.

The problem is that http://pinata.no-ip.org/~altmarvel/Scripts.php does
not return Javascript code but returns text/html, and no content.

--
Klaus Johannes Rusch
Kl********@atmedia.net
http://www.atmedia.net/KlausRusch/
Jul 20 '05 #13
Pierre Goiffon wrote:
Richard Cornford wrote:
There is no correct mime type for client-side javascript source.
Browsers appear to ignore content type headers sent in the
context of script elements.
Yes, it seems there are not any "official" mime type meant to
serve JavaScript.


After nine years of Internet javascript use it really feels like there
should be an official mime type doesn't it?
But are you sure any mime type would fit in any browser ?
I don't have access to all 40-odd javascript capable user agents, and it
was a couple of years ago that I tested this, but at the time I could
not get any browsers to refuse to handle JSP generated javascript as
javascript when sent with any of content-type header from a range that
included types that the browser would have had an attitude towards in
other contexts, unusual and very wrong types, and fictional mime types.
The browsers don't seem to care.

But how could they? Something isn't wrong until you judge what would be
right.
I was unclear about that, but unfortunatly haven't got enough
time to test yesterday evening.

In fact in a previous job we used JavaScript for external inclusion,
these JavaScript source were generated through ASP pages. As far as I
can remember we choosed to send something like
application/x-javascript because some browsers (probably NS4)
absolutly wanted something different from the default ASP text/html.
Her, I guess I'll test this evening...


Yes, that is exactly what happened to me. I was generating javascript
with JSP and a senior colleague told me to send text/javascript headers
with it, so I did. Later I was told on Usenet that it was nonsense so I
tried it out for myself and discovered that it was nonsense.

My experiment definitely included sending the content as text/html and
(Windows) Netscape 4 was among the test browser used. Also, in a couple
of years of regularly contributing to comp.lang.javascript, I have not
yet seen a javascript problem actually attributed to a content type
header on any browser or platform.

If you can find a browser that cares I would like to hear about it.

Richard.
Jul 20 '05 #14
Richard Cornford wrote:
There is no correct mime type for client-side javascript source.
But are you sure any mime type would fit in any browser ?
I was generating javascript
with JSP and a senior colleague told me to send text/javascript
headers with it, so I did. Later I was told on Usenet that it was
nonsense so I tried it out for myself and discovered that it was
nonsense.


Err well I guess I could now get exactly the same conclusion as you did.
Thanks a lot for your posts, I learnt something new ! Usenet is cool :)

--
Pour me répondre par mail privé, merci de supprimer _NOSPAM_ de mon
adresse.

Un grand merci à OE Quote Fix pour rendre OE utilisable :)
=> http://home.in.tum.de/~jain/software/oe-quotefix/

Jul 20 '05 #15

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

Similar topics

6
12945
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
1
3227
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
1
4792
by: Allen | last post by:
I am trying to add an additional photo/hyperlink to the company web site (I didn't create it) without any luck. The mouseover feature 'highlights' pics by swapping them with another pic using this...
3
2940
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None...
2
2943
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
19
3802
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
2458
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
3
3647
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
7
3590
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
1
47347
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.