Questions tagged [cross-browser]

Cross-browser development refers to the practice of building web sites, web applications, libraries, or components so that they function across different web browsers and rendering engines.

Cross-browser development refers to the practice of building web sites, web applications, libraries, or components so that they function across different web browsers and rendering engines. This contrasts with the concept of developing for one browser or engine.

9067 questions
209
votes
22 answers

How to detect input type=file "change" for the same file?

I want to fire an event when the user select a file. Doing so with .change event it works if the user changes the file every time. But I want to fire the event if the user select the same file again. User select file A.jpg (event fires) User select…
Gadonski
  • 3,150
  • 2
  • 25
  • 31
195
votes
13 answers

What are all the valid self-closing elements in XHTML (as implemented by the major browsers)?

What are all the valid self-closing elements (e.g.
) in XHTML (as implemented by the major browsers)? I know that XHTML technically allows any element to be self-closed, but I'm looking for a list of those elements supported by all major…
kamens
  • 11,910
  • 6
  • 45
  • 46
193
votes
9 answers

Javascript switch vs. if...else if...else

Guys I have a couple of questions: Is there a performance difference in JavaScript between a switch statement and an if...else? If so why? Is the behavior of switch and if...else different across browsers? (FireFox, IE, Chrome, Opera,…
John Hartsock
  • 85,422
  • 23
  • 131
  • 146
174
votes
16 answers

Detect Browser Language in PHP

I use the following PHP script as index for my website. This script should include a specific page depending on the browser's language (automatically detected). This script does not work well with all browsers, so it always includes index_en.php for…
GibboK
  • 71,848
  • 143
  • 435
  • 658
172
votes
15 answers

How to compress an image via Javascript in the browser?

TL;DR; Is there a way to compress an image (mostly jpeg, png and gif) directly browser-side, before uploading it ? I'm pretty sure JavaScript can do this, but I can't find a way to achieve it. Here's the full scenario I would like to…
pomeh
  • 4,742
  • 4
  • 23
  • 44
166
votes
4 answers

Browsers' default CSS for HTML elements

Where can I find a browser's default CSS for HTML elements? Many HTML elements come with some default CSS properties which can sometimes result in unknown/unwanted behaviour. For example Input boxes are displayed differently in different browsers.…
Nachshon Schwartz
  • 15,289
  • 20
  • 59
  • 98
159
votes
6 answers

Setting a width and height on an A tag

Is it possible to set the width and height in pixels on an anchor tag? I'd like to have the anchor tag to have a background image while retaining the text inside the anchor. li { width: 32px; height: 32px; background-color:…
Luke
  • 20,878
  • 35
  • 119
  • 178
158
votes
12 answers

css 'pointer-events' property alternative for IE

I have a drop down navigation menu in which some of the title should not navigate to other page when clicked(these title open a drop down menu when clicked on) while others should navigate (these dont have dropdown and navigate directly).However,…
Anupam
  • 7,966
  • 3
  • 41
  • 63
152
votes
6 answers

Show datalist labels but submit the actual value

Currently the HTML5 element is supported in most major browsers (except Safari) and seems like an interesting way to add suggestions to an input. However, there seem to be some discrepancies between the implementation of the value…
Stephan Muller
  • 27,018
  • 16
  • 85
  • 126
148
votes
16 answers

Is there a way to make text unselectable on an HTML page?

I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in many browsers. I might be able to solve this with a…
Tyler
  • 28,498
  • 11
  • 90
  • 106
141
votes
3 answers

Cross-browser testing: All major browsers on ONE machine

Aim of this guide: Running multiple unmodified native versions of Internet Explorer, Safari, Opera, Chrome and Firefox on a single machine, side-by-side. Covered in part 1: Table of contents Which browsers have to be tested? How to create a…
Rob W
  • 341,306
  • 83
  • 791
  • 678
138
votes
6 answers

Fixing JavaScript Array functions in Internet Explorer (indexOf, forEach, etc.)

As detailed elsewhere, and otherwise apparently well-known, Internet Explorer (definitely version 7, and in some instances, version 8) do not implement key functions, in particular on Array (such as forEach, indexOf, etc). There are a number of…
cemerick
  • 5,916
  • 5
  • 30
  • 51
133
votes
13 answers

Can I run multiple versions of Google Chrome on the same machine? (Mac or Windows)

This fabulous answer suggests there’s no way to run multiple versions of Google Chrome on one machine. Every now and then you’ll get a website user stuck on an old version of Chrome (no idea how, but it happens — maybe they installed the standalone…
Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
133
votes
8 answers

How to bring back "Browser mode" in IE11?

UPDATE: The old question applies only to IE11 preview; browser mode had returned in final release of IE11. But there is a catch: it is next to useless, because it does not emulate conditional comments. For example, if you use them to enable HTML5…
Evgeny
  • 6,261
  • 8
  • 35
  • 43
132
votes
8 answers

How to get screen width without (minus) scrollbar?

I have an element and need it's width without(!) vertical scrollbar. Firebug tells me body width is 1280px. Either of these work fine in Firefox: console.log($('.element').outerWidth() ); console.log($('.element').outerWidth(true) ); $detour =…
frequent
  • 27,643
  • 59
  • 181
  • 333