0

Is it possible to copy and paste a javascript library's code inside a HTML file?

I asked because I'm trying to make an app that needs angularjs but due to restrictions at work, I cant reference it to an angularjs file externally regardless if its over the internet or intranet.

I appreciate your help.

Thanks

1
  • 2
    You could..yes. Crude, but you can paste everything in file(s) inside a script tag in the index html file . Commented May 29, 2016 at 23:43

1 Answer 1

2

Yes this is possible but very much not recommended.

This can be done the following way using the <script> tag:

<body>
    <p>This is HTML bla bla bla...</p>
</body>
<script type="text/javascript">
    //Put your JS code here
</script>
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, Im currently trying it but I keep getting errors, because of commented lines with * or /*
the comments are being loaded instead of skipping them when I open the hmtl file but I got it working when I used the minified version of angular
Something was wrong with the comments if they were being loaded and executed. Make sure they are in the following format: \\Some code, /* Some code */

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.