HTML script and style tags are "embedded" in the web as inline elements despite being defined from the src attribute

1

Let's see if I explain myself well.

I have the problem that the HTML script and style tags are "embedded" in the web as inline elements despite having defined them from the src attribute. The strange thing is that this happens only when I connect from outside the network of my work, when I enter from the network of my work the code works well. I use the PHP Codeigniter Framework

My code is as follows:

<!DOCTYPE HTML>
<html>
  <head>
     <link rel="stylesheet" href="<?=base_url('css/' . $this->config->item('theme') . '/jquery-ui.css')?>" />
     <script type="text/javascript" src="<?=base_url('js/general/jquery.util.js')?>"></script>
  </head>
  <body>
     Hola mundo
  </body>
</html>

The result when the problem happens is as follows (inspecting the source code from the browser, outside the company network):

<!DOCTYPE HTML>
<html>
  <head>
     <style style="display:none">.......código css inline......</style>
     <script type="text/javascript" style="display:none">.......código js inline......</script>
  </head>
  <body>
     Hola mundo
  </body>
</html>

And when it runs well, it's the following (within the company's network):

<!DOCTYPE HTML>
<html>
  <head>
     <link rel="stylesheet" href="ruta-hacia-el-fichero">
     <script type="text/javascript" src="ruta-hacia-el-fichero"></script>
  </head>
  <body>
     Hola mundo
  </body>
</html>

My problem with this is because then with JS I use the SRC attribute of a script tag to do x things and when it gives the error because the SRC attribute does not exist because it has been embedded as an inline element in the web.

I hope you have explained me well,

Thanks for any suggestions.

    
asked by pescobar 19.04.2017 в 16:57
source

2 answers

0

The truth does not occur to me because the error, the only thing I can imagine revising is the configuration of both webservers (both in the place of your company, and in the place outside your company), php.ini of both web servers ESO if you mean 2 different machines when saying outside and within the network of my company,

but if you do not mean that and you mean that you are simply with the ip of your company and then without the ip of your company, I recommend that you verify the routes of the SRC that are being generated and the base_url that you have configured, so you can see if it is pointed well independent of which network you are connected to.

I hope you find the solution:)

    
answered by 19.04.2017 в 18:36
0

Try using base_url () by concatenating the path of the files instead of sending the path as a parameter to the function:

<link rel="stylesheet" href="<?=base_url() . 'css/' . $this->config->item('theme') . '/jquery-ui.css'?>" />
<script type="text/javascript" src="<?=base_url() . 'js/general/jquery.util.js'?>"></script>
    
answered by 05.05.2017 в 17:06