0

I have a Web app which is a monitoring tool. So someone it's going to keep it open on the browser all the day long. The problem is I'm refreshing the index page each 3 min:

var auto_refresh = setTimeout( function () { $('#page-body').load('/Monitor/Index').fadeIn("slow"); }, 180000); 

And every time the app refreshes itself, it's loading 3 javascripts which I'm invoking on my layout:

<script type="text/javascript" src="@Url.Content("~/Scripts/script-core-v1.0.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.dataTables.js")"> </script> <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.sparkline.js")"> </script> 

So, my browser keeps getting bigger and bigger every time the app refreshes, and I think the main reason are those scripts.

How can I avoid this problem? Thanks!

1
  • The memory area for code is treated specially by Javascript engines and might very well not be cleaned while staying on one site. Commented Dec 5, 2011 at 17:43

1 Answer 1

2

Load a specific part of that page, not the whole thing:

$('#page-body').load('/Monitor/Index body') ^^^^ 

That's a selector on the end so you can target a specific element.

When you don't provide a selector, the whole page is loaded (scripts and all). When you provide a selector, the <script> tags are stripped.

Also, your browser probably isn't leaking memory. Your website is just consuming it all.

Sign up to request clarification or add additional context in comments.

3 Comments

Hey Blender, thanks for that and you're right, my website is consuming it all..Don't know why, but when I'm trying to use that selector "body", looks like the browser it's not getting into all the hierarchy of my body tag: <div id="wrapper"> <div id="page-body"> <div class="container">... It just stops on the "page-body" level, so browser it's not rendering all the stuff which its more in a deeper level.. should I be more specific on that selector or what? tnx again!
Could you post a link to your site? That's strange.
It's been a while, don't remember what happened, but it's working. tnx though blender!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.