7

I am using Netbeans to edit my HTML project. I have defined the project as a PHP project (although it is just HTML).

The problem: Netbeans does not recognize this as Javascript:

<script type="application/javascript">

or

<script type="application/x-javascript">

As such it does not enable Javascript editing features. (Autocomplete and such...)

Instead it only recognizes <script type="text/javascript">.

Is there a custom way to cause the editor to recognize "application/javascript" as Javascript?

3
  • what is the version of netbeans that you are using? Commented Nov 2, 2010 at 13:34
  • I suppose you could mark everything up as "text/javascript" and then do a project-wide find-n-replace when you deploy. Though, this isn't a sustainable solution. Commented Nov 5, 2010 at 22:25
  • - I am using nightly build 7.02 and also version 6.9 . Commented Nov 7, 2010 at 7:02

2 Answers 2

1

I believe Netbeans is looking for <script type="text/javascript"> before autocomplete is enabled. They are probably following the W3 HTML specification for inline JavaScript.

The question on which is the correct MIME type for JavaScript comes up often. The official MIME type is application/javascript, but some browsers don't support this. The industry standard has become 'text/javascript'.

Sign up to request clarification or add additional context in comments.

Comments

0

Putting the javascript in a separate file from the HTML would solve it, wouldn't it? Or is that not an option?

Found this: http://forums.netbeans.org/topic6181.html

2 Comments

No,The problem is this project is allready 90% done. I have gotten into it now... I do not want to change the current HTML files (that would be impolite...).
ok, you can be polite and suffer, or you can make the script tags src to the js files and have context editing :^) your choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.