EzDevInfo.com

window interview questions

Top window frequently asked interview questions

window.location vs. document.location [duplicate]

Possible Duplicate:
What's the difference between window.location and document.location in JavaScript?

In JavaScript, both window and document have a location property, and by setting both to a different URL, browser loads the new URL.

What's the difference between them?


Source: (StackOverflow)

WPF Icon for all app windows

It is possible to set one Icon so, that it would be used on every window in current app. So that i set it once (not on every window by hand)..?


Source: (StackOverflow)

Advertisements

Difference between screen.availHeight and window.height()

I am executing the following Javascript on my browser (Firefox).

  1. console.debug("Screen height = "+ screen.availHeight); //outputs 770

  2. console.debug("Window Height ="+ $(window).height()); //outputs 210 (I am using jQuery as well)

What is the difference between the two? Is 770 in pixels and 210 in mm?

Similarly, when I write $(document).height() and $(window).height(), there is a difference. What is the reason?


Source: (StackOverflow)

How to increase the vertical split window size in Vim

:vsplit (short form: :vs) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once this 30 char window is created, how would one change it's size to 31 or 29?

With horizontal windows Ctrl-W + increases the number of lines by one. What is the equivalent command to increase the columns by one?


Source: (StackOverflow)

Finding the handle to a WPF window

Windows forms had a property win1.Handle which, if I recall, returns the handle of the main window handle?

Is there an equivalent way to get the handle of a WPF Window?

I found the following code online,

IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;

but I don't think that will help me because my application has multiple windows.

Thanks!!


Source: (StackOverflow)

How can I open a Shell inside a Vim Window?

I can open a shell by using the :shell command in Vim, however I can't edit a file and at the same time use the shell.

Is there any way to split Vim in many Windows (or tabs), and have a shell opened in one of them?


Source: (StackOverflow)

Is it possible to create desktop applications with node.js? [duplicate]

This question already has an answer here:

I've created an application using node.js, and I'm interested to know if it's possible to pack the client side (js, html ,css) and the server side into a standalone application (that doesn't required browser).


Source: (StackOverflow)

location.host vs location.hostname and cross-browser compatibility?

Which one of these is the most effective vs checking if the user agent is accessing via the correct domain.

We would like to show a small js based 'top bar' style warning if they are accessing the domain using some sort of web proxy (as it tends to break the js).

We were thinking about using the following:

var r = /.*domain\.com$/;
if (r.test(location.hostname)) {
    // showMessage ...
}

That would take care of any subdomains we ever use.

Which should we use host or hostname?

In Firefox 5 and Chrome 12:

console.log(location.host);
console.log(location.hostname);

.. shows the same for both.

Is that because the port isn't actually in the address bar?

http://www.w3schools.com/jsref/obj_location.asp says host contains the port.

Should location.host/hostname be validated or can we be pretty certain in IE6+ and all the others it will exist?


Source: (StackOverflow)

Is it alright to use target="_blank" in HTML5?

I recall reading somewhere that in HTML5 it was no longer okay to use target="_blank" in HTML5, but I can't find it now.

Is it alright to continue to use target="_blank"?

I know it's generally considered a bad idea, but it's by the easiest way to open a new window for something like a PDF, and it also doesn't require you to rely on JavaScript.


Source: (StackOverflow)

What's the difference between window.location= and window.location.replace()?

Is there a difference between these two lines?

var url = "http://www.google.com/";
window.location = url;
window.location.replace (url);

Source: (StackOverflow)

$(window).scrollTop() vs. $(document).scrollTop()

What's the difference between:

$(window).scrollTop()

and

$(document).scrollTop()

Thanks.


Source: (StackOverflow)

Cancel split window in Vim

I have split my windows horizontally. Now how can I return to normal mode, i.e. no split window just one window without cancelling all of my open windows. I have 5 and do not want to "quit", just want to get out of split window.


Source: (StackOverflow)

How to terminate a window in tmux?

How to terminate a window in tmux? Like the Ctrlak shortcut in screen with Ctrla being the prefix.


Source: (StackOverflow)

How to make HTML open a hyperlink in another window or tab?

This is a line for a hyperlink in HTML:

<a rel='nofollow' href="http://www.starfall.com/">Starfall</a>

Thus, if I click on "Starfall" my browser - I am using FireFox - will take me to that new page and the contents of my window will change. I wonder, how can I do this in HTML so that the new page is opened in a new window instead of changing the previous one? Is there such a way in HTML?

And if yes, is there a way to open the requested page in another tab (not another window) of my browser?


Source: (StackOverflow)

How to open in default browser in C#

I am designing a small C# application and there is a web browser in it. I currently have all of my defaults on my computer say google chrome is my default browser, yet when I click a link in my application to open in a new window, it opens internet explorer. Is there any way to make these links open in the default browser instead? Or is there something wrong on my computer?

My problem is that I have a webbrowser in the application, so say you go to google and type in "stack overflow" and right click the first link and click "Open in new window" it opens in IE instead of Chrome. Is this something I have coded improperly, or is there a setting not correct on my computer

===EDIT===

This is really annoying. I am already aware that the browser is IE, but I had it working fine before. When I clicked a link it opened in chrome. I was using sharp develop to make the application at that time because I could not get c# express to start up. I did a fresh windows install and since I wasn't too far along in my application, I decided to start over, and now I am having this problem. That is why I am not sure if it is my computer or not. Why would IE start up the whole browser when a link is clicked rather than simply opening the new link in the default browser?


Source: (StackOverflow)