Paul
Paul

Reputation: 3880

Include the prototype.js code directly in the html file

Is there a way to include the prototype.js code directly in the html file? I do not want to have something like this:

<script type="text/javascript" src="/path/to/prototype.js"></script>

I want something like this:

<script type="text/javascript" >
// the code of prototype.js to be here 
</script>

The context for what I want this is more complex. I just want to know now if this is possible or not. P.S.I'm not very familiar with Prototype.

Thank you.

Upvotes: 1

Views: 784

Answers (2)

Mic
Mic

Reputation: 25164

We do something similar with jQuery and our other JS and CSS files for our web app. They are all compressed and included inline when we run our deployment script.

It makes the page relatively heavy (300kb) but the main advantage is you get everything in a single http request. This makes the app look very fast.
The page is then cached, making next visits even more responsive.

Upvotes: 1

David Nguyen
David Nguyen

Reputation: 8508

Yes it will work if you copy paste the entire content inside the script tags.

Upvotes: 4

Related Questions