0

Supposedly I have a <script> tag like this:

<script type="text/javascript" src="http://localhost/public/assets/v1/javascripts/min/main.js"></script>

I want to get the content of "localhost/public/assets/v1/javascripts/min/main.js", echo it between the script, without actually putting the src attribute, is it possible to do this?

user2002495
  • 2,126
  • 8
  • 31
  • 61
  • Open the HTML document in a text editor and paste it in? I'm really not clear on what it is you hope to achieve. – Quentin Feb 11 '14 at 15:58
  • Only if it's on the same domain, with ajax. – Benjamin Gruenbaum Feb 11 '14 at 15:59
  • @Benjamin: yes same domain, how to do with ajax? – user2002495 Feb 11 '14 at 16:00
  • @user2002495 see http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call/16825593#16825593 – Benjamin Gruenbaum Feb 11 '14 at 16:00
  • @Quentin: I'm trying to hide the source of my js files in the dom element – user2002495 Feb 11 '14 at 16:00
  • 1
    @user2002495 — Stop wasting your time. There is no way to hide the JS that the browser parses. – Quentin Feb 11 '14 at 16:01
  • Ajax won't solve that. You can just view the ajax call by viewing the source or pressing F12 and watching the network traffic. I agree with @user2002495, get familiar with F12. – gfrobenius Feb 11 '14 at 16:01
  • What could you possibly need to hide? You could always just obfuscate your code to make it difficult for humans to read... – James Donnelly Feb 11 '14 at 16:05
  • The only way I know of to do this is an absolutely terrible idea. You would load the JS as text and then use `eval` to interpret the scripts. However, this is easily done using a server-side language like PHP and includes to add the code without disclosing its file system location. – Harvey A. Ramer Feb 11 '14 at 16:05

0 Answers0