Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
diadem
Sep 20, 2003
eet bugz
Backstory
I asked this in the .net megathread but it's really a javascript question.

I've got an updatepanel in an ascx page. Basically this is an asych call that requests new data for a particular DOM. It gets data back from a server and updates the DOm based on that data.

This is using the microsoft ajax framework and is all automatic - Microsoft software communicating to Microsoft software through a Microsoft server.

99 times out of 100, this works fine.

My issue:
1 time out of 100, the DOM gets updated and the window doesn't redraw properly, The user has to maximize the browser or do something else to trigger a redraw. Putting javascript in to force a resize doesn't seem to work - it has to be done by the user.

Sometimes the browser gets refreshed once the user's mouse leaves the window and comes back.

This is a huge pain in the rear end because it looks unprofessional but it's all pre-canned stuff I have no control over.

Request:
I'd very much like to force Internet Explorer to refresh its display using javascript. The DOM changed and I want the view of the page to reflect the change without the user having to jiggle the window around.

Adbot
ADBOT LOVES YOU

diadem
Sep 20, 2003
eet bugz

Supervillin posted:

Modifying the DOM again should trigger it, some libraries (I think scriptaculous?) create, append, and remove a text node containing only spaces. I did a little searching and found that adding and removing a class, or even just reassigning a class works.

code:
// this should do it
element.className = element.className;


// if not, this should do it
element.className += "forcedomredraw";
element.className = element.className.replace(/forcedomredraw/, '');


// if not, try this?
var redraw = function(element) {
    var t = document.createTextNode(' ');
    element.appendChild(t);
    setTimeout(function() {
        n.parentNode.removeChild(n);
    }, 0);
};
// changeDomStuff();
redraw(document.getElementById('whatever'));

// if not, kill everyone at Microsoft.



Thank you so much. This bug was a huge pain.

For some reason, spaces weren't cutting it, but characters worked fine. A slightly modified version of your last suggestion fixed the issue.

var t = document.createTextNode('temp text');
element.appendChild(t);
setTimeout(function() {
t.parentNode.removeChild(t);
}, 0);

diadem fucked around with this message at 19:34 on May 7, 2009

diadem
Sep 20, 2003
eet bugz
I'm looking to force my zoom level to 100% in IE7 and IE8 on one of my sites, but can not find a way to do this. Is this even possible?

If it matters, my IE8 sites all force compatibility mode.

diadem
Sep 20, 2003
eet bugz
How do you detect if the current window has focus?

diadem
Sep 20, 2003
eet bugz
Thanks lumpy. I tried a few variations of this, but still have no go. I'll keep at it.

diadem
Sep 20, 2003
eet bugz
Does anyone know what causes the white screen of annoyance with all flavors of IE7 and Updatepnaels? Once every few dozen callbacks (only from .net update panels, not when done manually), I get the dreaded white screen of annoyance.

Basically, an entire frame is white and I need to resize the page or whatever to fix the screen. If I trigger a refresh, it has to be in the appropriate div or frame or the drat thing won't away.

edit: There seems to be no pattern as to WHEN it will happen. I'm even talking about completely automated tests - there seems to be no rhyme or reasons as to where or when this may happen.

diadem fucked around with this message at 21:54 on Sep 10, 2009

Adbot
ADBOT LOVES YOU

diadem
Sep 20, 2003
eet bugz
I opened a window using window.open. I pass in the argument scrollbars and set the value to either yes or no.

I am now in the child window. My javascript is running. I want to know if the window has scrollbars enabled or not. How do I do this?

- I am in IE so window.scrollbars/this.scrollbars won't return anything
- The windows scrollbars exist outside the body.
- Looking at the document's width will tell me about the document. I can even figure out if there are scrollbars in the document. This will not tell me anything about the window itself.
- The width of the scrollbar in question changes Dependant on what the currently selected Windows Desktop Theme is, for ascetic reasons.

edit: To be perfectly clear - I need to know if the application has scrollbars, not if the body's overflow has a scrollbar. I need this information to call window.resize. Both the application's scrollbar and the little bar on the left of the application window that lets you resize it are taken into account with window.resize. Just looking at the html inside it isn't enough. I need to know the expected width of the application window itself for this to work right.

diadem fucked around with this message at 21:11 on Feb 23, 2010

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply