473,734 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript stops working after enabling embedded PHP in Apache

After issuing the command (apache httpd.conf file)
AddType application/x-httpd-php .php .htm .html
any attempt to include javascript code
<script src="file.js" type="text/javascript"></script>
into htm (or html) file fails. How can I successfully config Apache2 to
work with
embedded PHP and javascript at same time?

TIA,

Bernhard Enders.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 23 '05 #1
2 6906
On 2004-10-22, Bernhard Georg Enders <bg*****@hotmai l.com> wrote:
work with embedded PHP and javascript at same time?


Use a php #include to load the js file.
Davide

--
If Bill Gates had a nickel for every time Windows crashed... Oh wait, he
does!

-- From a Slashdot.org post
Jul 23 '05 #2
Bernhard Georg Enders wrote:
After issuing the command (apache httpd.conf file)
AddType application/x-httpd-php .php .htm .html
any attempt to include javascript code
<script src="file.js" type="text/javascript"></script>
into htm (or html) file fails. How can I successfully config Apache2 to
work with
embedded PHP and javascript at same time?


You shouldn't be having a problem, you aren't modifying either the mime
type (text/javascript) nor the extension (.js) with that directive.

I would suggest you do 3 things:

1) search httpd.conf for other instances of ".js".
2) check mime.types for other instances of "text/javascript" or ".js", the
only one you might have is "applicatio n/x-javascript js" and that
should not affect your ability to send script as <script
type="text/javascript">
3) ensure your JavaScript loads correctly _without_ PHP, and after you've
enabled PHP, ensure that the HTML source you are viewing is what you
_think_ you're sending. For example, if you had PHP that looked like: echo
"script type=\"text/javascript\" src=\"" . someVariable . "></script>"; Do
you notice the closing quote on the SRC attribute is missing? You would if
you loaded that page into your browser and did a View -> Source.

But quite frankly, most browsers aren't that picky. For example, our
corporate Web server sends .js files as application/x-javascript, and I've
never had a problem with <script type="text/javascript">. I would suspect
your problem is more with some change you made to the .js file, or some
interaction between quotation marks delimiting PHP text and internal
quotation marks within the generated HTML. That's why it's important to
View -> Source.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

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

Similar topics

15
3520
by: Bob Smith | last post by:
Hi all I have a page which contains a form. I want a customized button with an image for the submit button, and when the submit button has been clicked send the form to the perl script. Now the form is no problem but the button is, so the question is how do I create a custom button and how do I submit the form with javascript when the button is clicked? many thank's for any hint and help B
53
5737
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is difficult to know what is going on. One of these Order Forms you can see here... http://www.cardman.co.uk/orderform.php3
1
1517
by: Steve | last post by:
I have almost got this no touch deployment of WinForms working Except... 1) Occasionally the launching of the application stops and I get the IE Message "The page cannot be found". If I restart IIS then it works again 2) Sometimes the app.config file stops downloading. Again, If I restart IIS then it works again.
4
1849
by: Malik Arykov | last post by:
Hello, All! how debug embedded javascript?
16
2333
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript on the same page work correctly. It appears to be isolated to 1-2 machines in a particular network. I cannot verify whether these machines have had virus/spyware scans, but I do know the user is running Firefox 2.1 and IE 7 with the same...
21
1862
by: TonyV | last post by:
Hi all, I'm trying to use some javascript code in Internet Explorer 6.0 that's being generated by a Perl file. I have a line in my header that looks something like this: <script src="jscode.pl?parm1=foo&parm2=monkey" type="text/javascript" / Just for the sake of simplicity, here's a very simplified version of the Perl code:
13
12443
by: Gordon | last post by:
I want to use my new Macbook Pro as a development platform for work, so I went looking for info on installing Apache, PHP, Postgres, etc on Leopard. I discovered in my search that Apache and PHP are already installed by default, but disabled, so I'd just have to enable the already-installed versions. Getting Apache up and running was no problem. You just check "enable web sharing" in the Sharing control panel and away you go. getting...
17
2969
by: happyse27 | last post by:
Hi All, The html page(see item a below) is calling javascript(item b below), but cant work as the page show blank. Not sure if the method of calling is wrong(in terms of default directory) or javascript is wrong. using 127.0.0.1/htmlscript.html below to call the java script embedded in the following html script. I am using apache server and apache server have error 304(not modified) Been trying many methods for past 1...
4
5259
by: happyse27 | last post by:
Hi All, The html page(see item a below) is calling javascript(item b below), but cant work as the page show blank. Not sure if the method of calling is wrong(in terms of default directory) or javascript is wrong. using 127.0.0.1/htmlscript.html below to call the java script embedded in the following html script. I am using apache server and apache server have error 304(not modified) Been trying many methods for past 1 week...
0
8946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2180
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.