NetTalk Central

Author Topic: Add script on One page  (Read 2043 times)

linas@debetas.lt

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Add script on One page
« on: November 29, 2011, 04:27:44 PM »
Hi,

I successfuly add extra script  myscriptfile.js to the site properties in head section of the page, then it exist in all pages. The problem is that takes time to download because each page will request it.

Is it possible to add scrip for if I load specified netwebforms?  I use nettalk5 latest


Example

<html>
  <head>
              <title>My First chart using FusionCharts - Using JavaScript</title>
             <script type="text/javascript" src="FusionCharts/FusionCharts.js"></script>  
</head>    
<body>
....
....
</body>
</html>

this line  <script type="text/javascript" src="FusionCharts/FusionCharts.js"></script>  must be in the head.



Linas
« Last Edit: November 29, 2011, 04:54:20 PM by linas@debetas.lt »

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Add script on One page
« Reply #1 on: November 29, 2011, 06:33:43 PM »
Check out the XHTML Tab on your netwebform. You can add it there or as a p_web.script() (I'm not sure if that is the right syntax) in your handcode.

You also need to add your script to the webserver, settings, Scripts Tab which I guess if it is working, you probably have already done.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Add script on One page
« Reply #2 on: November 29, 2011, 08:33:17 PM »
Hi Linus,

>> The problem is that takes time to download because each page will request it.

If you look in your server log, you'll notice this assumption is wrong.
Since the browser caches js and css files, the user only gets them once.
Thus adding them "globally" makes life a lot easier for you and ultimately results in more reliability.

Cheers
Bruce

linas@debetas.lt

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Re: Add script on One page
« Reply #3 on: November 30, 2011, 03:14:26 PM »
Hi Bruce,

Yes global use is very handy.

Tested, caching depends on the browser settings, so not allways caches, and also the JS I have on top includes more JS files.. so you download a bunch of flowers.

Found a way how to use script in different way.


Linas