EzDevInfo.com

browser interview questions

Top browser frequently asked interview questions

What is the maximum length of a URL in different browsers?

What is the maximum length of a URL in different browsers? Does it differ between browsers?

Does the HTTP protocol dictate it?


Source: (StackOverflow)

What's the difference if exists or not?

What's the difference if one web page starts with

<!DOCTYPE html> 
<html> 
  <head> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 

and If page starts with

<!DOCTYPE html> 
<html> 
  <head> 
     <!-- without X-UA-Compatible meta -->

If there is no difference, I suppose I can just ignore the X-UA-Compatible meta header, since I just want it to be rendered in most standard mode in all IE versions.


Source: (StackOverflow)

Advertisements

Detect if device is iOS

I'm wondering if it's possible to detect whether a browser is running on iOS, similar to how you can feature detect with Modernizr (although this is obviously device detection rather than feature detection).

Normally I would favour feature detection instead, but I need to find out whether a device is iOS because of the way they handle videos as per this question YouTube API not working with iPad / iPhone / non-Flash device


Source: (StackOverflow)

Hiding the scrollbar on an HTML page

Can CSS be used to hide the scroll-bar? How would you do this?


Source: (StackOverflow)

Auto detect mobile browser (via user-agent?) [closed]

How can I detect if a user is viewing my web site from a mobile web browser so that I can then auto detect and display the appropriate version of my web site?


Source: (StackOverflow)

What is the maximum possible length of a query string?

Is it browser dependent? Also, do different web stacks have different limits on how much data they can get from the request?


Source: (StackOverflow)

How to copy text to the client's clipboard using jQuery? [duplicate]

This question already has an answer here:

The workflow is simple:

  1. You click inside a textarea.
  2. The text is copied to the client's clipboard.
  3. Display notice to the user.

How do you do it?


Source: (StackOverflow)

What is the maximum size of a web browser's cookie's key?

I'm wondering what the maximum size of a web browser's cookie's key is. I know the maximum size of a cookie is 4KB, but does the key have a limitation as well?


Source: (StackOverflow)

Disabling Chrome cache for website development

I am modifying a site's appearance (css modifications) but can't see the result on chrome because of annoying persistent cache. I tried shift+refresh but it doesn't work. how can i disable the cache temporarily or refresh the page in some way that I could see the changes?

thanks.


Source: (StackOverflow)

array.contains(obj) in JavaScript

What is the most concise and efficient way to find out if a JavaScript array contains an obj?

This is the only way I know to do it:

function contains(a, obj) {
    for (var i = 0; i < a.length; i++) {
        if (a[i] === obj) {
            return true;
        }
    }
    return false;
}

Is there a better and more concise way to accomplish this?

This is very closely related to Stack Overflow question Best way to find an item in a JavaScript Array? which addresses finding objects in an array using indexOf.


Source: (StackOverflow)

Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

I've seen a couple questions around here like How to debug RESTful services, which mentions:

Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.

I've also heard this, that browsers support only GET and POST, from some other sources like:

However, a few quick tests in Firefox show that sending PUT and DELETE requests works as expected -- the XMLHttpRequest completes successfully, and the request shows up in the server logs with the right method. Is there some aspect to this I'm missing, such as cross-browser compatibility or non-obvious limitations?


Source: (StackOverflow)

Why do browsers match CSS selectors from right to left?

CSS Selectors are matched by browser engines from right to left. So they first find the children and then check their parents to see if they match the rest of the parts of the rule.

  1. Why is this?
  2. Is it just because the spec says?
  3. Does it affect the eventual layout if it was evaluated from left to right?

To me the simplest way to do it would be use the selectors with the least number of elements. So IDs first (as they should only return 1 element). Then maybe classes or an element that has the fewest number of nodes — e.g. there may only be one span on the page so go directly to that node with any rule that references a span.

Here are some links backing up my claims

  1. http://code.google.com/speed/page-speed/docs/rendering.html
  2. https://developer.mozilla.org/en/Writing_Efficient_CSS

It sounds like that it is done this way to avoid having to look at all the children of parent (which could be many) rather than all the parents of a child which must be one. Even if the DOM is deep it would only look at one node per level rather than multiple in the RTL matching. Is it easier/faster to evaluate CSS selectors LTR or RTL?


Source: (StackOverflow)

Determining a web user's time zone

Is there a standard way for a Web Server to determine what time zone offset a user is in?

Perhaps from a HTTP header? Or part of the user-agent string?


Source: (StackOverflow)

Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on the same machine

Like everyone else, I need to test my code on Internet Explorer 6 and Internet Explorer 7. Now Internet Explorer 8 has some great tools for developer, which I'd like to use. I'd also like to start testing my code with Internet Explorer 8, as it will soon be released.

The question is: how to run Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on the same machine. So far with Internet Explorer 6 and Internet Explorer 7 I've been using Multiple IE. But people have reported (see comments on the page linked in the previous sentence) issue with Internet Explorer 6 after installing Internet Explorer 8. Those errors are related to focus in form fields. Running Internet Explorer 7 wouldn't matter so much as Internet Explorer 8 can use the Internet Explorer 7 rendering engine, but we still need Internet Explorer 6.

How to run Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on the same machine?


Source: (StackOverflow)

Is there a way to detect if a browser window is not currently active?

I have JavaScript that is doing activity periodically. When the user is not looking at the site (i.e., the window or tab does not have focus), it'd be nice to not run.

Is there a way to do this using JavaScript?

My reference point: Gmail Chat plays a sound if the window you're using isn't active.


Source: (StackOverflow)