Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:25:31+00:00 2026-06-04T19:25:31+00:00

EDIT: Sorry, I should have been more clear. My webpage needs to be XHTML

  • 0

EDIT: Sorry, I should have been more clear. My webpage needs to be XHTML compliant.

I use a hosted blogging platform, and there’s no way for me to host a JavaScript file on it. We normally reference JavaScript file on a web page like this:

<script type='text/javascript' src='http://example.com/js/mycode.js'></script>

The question is, can I directly reference code in the web page, instead of the file? If so, how do I do that?

  1. Just paste the JavaScript code in the file between <script> tags?

    <script type='text/javascript'>
    PASTE THE CODE FROM THE JS FILE HERE
    </script>
    
  2. OR like this?

    <script type='text/javascript'>
    //<![CDATA[
    PASTE THE CODE FROM THE JS FILE HERE
    //]]>
    </script>
    

Which of the above two methods is correct? If not, is there a better way to do it?


Also, can a text (.txt) file be referenced inside a script tag, like this?

<script type='text/javascript' src='http://example.com/js/mycode.txt'></script>

or will there be any issues if I do it like this?

Looking for a knowledgeable answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:25:33+00:00Added an answer on June 4, 2026 at 7:25 pm

    Can I directly reference code in the web page, instead of the file?

    Yes you can paste your code between the <script> tags. HTML even allows bare script tags since browsers ignore the language attribute and type attribute can be omitted according to spec.

    The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is “text/javascript”.

    So you can have this:

    <script>
        //your code
    </script>
    

    Also, you have the option to host your script externally and have this instead

    <script src="http://externalhost.com/yourscript.js"></script>
    

    Also, can a text (.txt) file be referenced inside a script tag, like this?

    As far as I know, you can put anything plain text as your source and the browser will read it as JavaScript by default. Even text from pastebin can act like a script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: I am using SqlDataAdapters to fill the data sets. Sorry--I should have been
EDIT Sorry I forgot the most important part here. Each key can have more
Sorry for bumpy topic name (feel free to edit if you find more fitting
IMPORTANT EDIT: Sorry everyone, i made a big mistake in the structure. char *name;
Edit Question: Sorry about this basic question. This is a new technology to me.
EDIT: I'm sorry Stack Overflow, but I'm retarded. frac(tex_offset) -> fract(tex_offset) , and it
EDIT: It does work (sorry). Something in this script is causing it to stop
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
EDIT: Problem solved... and unrelated to the phrasing of the question... sorry for the
Edit: When I say SQL Server, I'm really talking about the Management Studio. Sorry

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.