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 9234205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:44:09+00:00 2026-06-18T06:44:09+00:00

I usually include javascript like this: <script type=text/javascript src=js/somejs.js> is there a way like

  • 0

I usually include javascript like this:

<script type="text/javascript" src="js/somejs.js">

is there a way like this :

<script type="text/javascript" src="js/somephp.php?js=somejs">

So that the PHP Script echoes a custom generated string or file of requested name

If this is possible how should be the basic php syntax?

Thanks in advance.

  • 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-18T06:44:10+00:00Added an answer on June 18, 2026 at 6:44 am

    Yes, it’s possible. The script tag doesn’t care whether the URL it’s pointed at ends with ‘.js’ or not. If you point it at some URL that will serve valid javascript, then you’re all good, whether that URL ends in ‘.js’ or ‘.php’ or anything else, and whether the mechanism for serving it is your apache server serving a file straight from the file system, a PHP file echoing out the javascript, or anything else that you please.

    If you do decide to serve JavaScript by echoing it out via PHP, to be neat and correct you should set the content type header to ‘application/javascript’ by calling header('Content-type: application/javascript'); respectively.

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

Sidebar

Related Questions

I usually have to check things like: if ['Bob','Mary','John'].include? @user.name Is there a way
Usually, I can include MathJax in a script tag like: <script src=path-to-MathJax/MathJax.js?config=default></script> But with
hello frieds this is how i usually post a variable using Jquery.. $.post(include/save_legatee.inc.php, {
Usually like this: #include <boost/assign/std/vector.hpp> vector<int> v; v += 1,2,3,4,5; Except for a: #include
Almost every ios app now has something like Feed option. Programming that usually includes
this is a little bit tricky. usually when someone clicks on a link that
Really simple question: Am I missing something? Seems like this should be all that
What do DBMSs that implement multi-version timestamp ordering for concurrency control usually include in
I've been experimenting with C a little bit. I usually use PHP and javascript.
Is there a way (preferrably using JavaScript) to determine whether a URL is to

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.