View Full Version : Browser Compatibility problems ..Hide function of javscript

02-10-2013, 07:00 AM
Hide() function in Js is not working in IE ?
Which is the other function available parallel to this hide(); with cross browser supporting

Iam complicated about thinking some functions of Js are working in some browsers but not at all..

Really which are js functions support for all browsers ? how can we apply a logic/solution to avoid browser compatibility problems of Javascript ?

02-12-2013, 01:32 AM
hide() is not a js function. Are you using jQuery? If so, jQuery's .hide() does work in IE 7. However, depending upon how you use it in that browser, it might not. Older browsers are generally trickier to work with even in something like jQuery which tends to normalize differences.

If hide() is a function you wrote in regular javascript or copied from somewhere else where it was written in regular javascript, it may or may not have what it takes to work in IE 7. From what you're saying it doesn't, at least not the way you're using it.

In any case, if you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

02-12-2013, 12:02 PM
Thanks MR. John

No i am not using jquery

That means if we are using jquery and use hide(), show() that will work in all browsers including all versions of IE, Chrome, Opera, Safari, Mozilla etc etc ......(ALL). Then there will no problem arise for browser incompatibility ?

what is the term of the license for jquery ? Is any prblem arise if we use this type of third party applications ?

02-12-2013, 04:39 PM
jQuery supports IE 6 and later. However, if it's something a particular IE browser just cannot do, you may need to make your own routine for it for that browser to substitute another similar effect or make sure your code degrades gracefully in that browser. In some cases you must make sure you're working with valid HTML and/or have set any required prerequisite css on the element you're working on. Said css may not be required in newer more compliant browsers.

jQuery also supports all current versions of browsers, and most past ones that are still in use, even some that aren't.

jQuery is free for use by all under an MIT style license. Its .hide() and .show() functions are pretty straightforward. As long as they are used with the proper syntax, on valid markup, you should be fine.

There's extensive searchable online documentation:


And the code itself is hosted on Google's servers so you can use that. The latest version is generally:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

If you put that in the head of your page before any code that uses jQuery you will have the latest version.

That's usually but not always the best version to use. Google hosts virtually all the versions, so you can specify a sub version or even a sub sub version:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

02-12-2013, 07:25 PM
Dear John

Thanks for your valuable advices. You have any suggestion for my following question ?

Testing a Web Application in all browsers are very difficult. Exactly we don't know how many browsers are existing in cyber world. Or other wise testing application in these 1000 browsers in real sense it is totally impossible.

Then what is a solution to check the output of javascripts in a single browser ? Like Mozilla .. that same result we got in Mozilla, should be produced when accessing from all other browsers.

02-12-2013, 09:02 PM
Right now Chrome and IE are the two most used browsers and their market share is about even with Chrome slowly (or quickly, depending upon who you believe) overtaking IE. Mozilla's share is shrinking and was never more than a threat to IE's dominance. Not like Chrome, which is (or at least was last I checked) overtaking IE. Of older versions of IE Only IE 8 and up are used much these days.

So I would say check in IE 8, 9, and 10, and Chrome (latest version, they're real good about keeping their product up to date on all computers) at least. I'd throw in Mozilla Firefox because a lot of folks still use that. Other than those, it's just up to you about whether or not you want to support IE 7 or 6, or Opera, or any other browser. Opera and others (not earlier IE) will generally work if those 5 (including Firefox) listed above work, though there can be exceptions. IE 7 and less must be checked individually if they're important to you. An experienced coder can generally know which sort of things might trip up early IE, but no one can tell for sure without checking.

02-13-2013, 07:28 PM

Is there any JavaScript or PHP coding available for the following ?

If the Browser of the Visitor is (IE- 8,9 10) || (G-Chrome-latest 2 versions) || (Mozilla latest 2 versions) || (Safari latest 2 versions)

Continue the access for website


Your Browser is not supported by our website / You need IE, G-chrome, mozilla or safari to continue the access..

adding above restriction is good in cyber world ?

02-13-2013, 10:36 PM
There's no practical way, perhaps no way to know the latest two versions of those browsers. They update too frequently. You could settle for the current version and higher, in which case it could be done.

However, of the very few people using outdated browsers, most are doing it either for diagnostic purposes or they are at least aware that their browser is outdated and expect the occasional rendering and script problems.

Chrome updates automatically in the background unless you change its default settings. If you update your computer at all, IE 6 and 7 will be replaced by IE 8 unless you specifically tell the updater not to. If you do, you will be warned that this is an important performance and security update. I don't know Safari's update policy. Firefox (which is different than Mozilla, there are a number of Mozilla based browsers aside from Firefox) is pretty aggressive in keeping it's installed browsers updated. You have to specifically tell it not to update and will be warned that it's unwise not to update.

Many browsers that are not these browsers will do just fine as long as the page performs well in these browsers, and the number of people using these other browsers is very small and they are usually aware of any problems that are common to their browser and know ways of dealing with them.

In light of that, the answer to your question would have to be "no". If someone has another browser, they should at least be allowed to try viewing your pages. You can have something hard coded into the index page perhaps, like:

<div>Best viewed in Chrome.</div>

But other than that, you should let people do whatever they want to or need to - some people just can't run anything better than what they have due to the age of their hardware, and/or due to physical handicaps like blindness, etc. And your page should 'work' if all styles, and/or all images, and/or all javascript are turned off or missing. It doesn't have to pretty like that, but the essential information and links on it should still be accessible.

02-14-2013, 04:24 AM
Thanks Jo .. Highly informative

One more Question what is the difference between

From Jquery.com

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.min.js"></script>


From the Link you had given

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

02-14-2013, 06:10 AM
What you are calling the link I gave is actually two possible links you can use. Don't use both at once. Of the two I gave, the first will give you the latest release version in the jQuery 1 series (currently 1.9.1, but if 1.9.2 comes out, it will automatically switch to that). There is no 2 series - yet. The second one will give version 1.8.3, which was the last and best of the 1.8 series.

What you have is series 1, sub version 9, sub, sub version 1 (as already noted, currently the most recent release, but in this case, if 1.9.2 comes out, it will still only be 1.9.1) and a script (migrate) that allows it to handle code written for some earlier versions of jQuery (1.9.1 eliminates several common jQuery syntaxes that had been deprecated but not removed in prior versions).

Another difference between what you have and what I supplied is the host. The two scripts you list are on jQuery's jquery domain, The two I offered are on Google's ajax.googleapis domain. The actual code would be the same though, as long as you're accessing the same version. Additionally I don't believe Google is hosting the migrate script. And, so far as I know, only Google allows partial version numbers with automatic updating to the most recent sub and/or sub, sub version.

So essentially there's little practical difference. The concept involved is that instead of hosting the jQuery library yourself (which you can do if you like), you are using a copy of it hosted on another server. The main advantage in doing so is that it may already be cached on the user's computer. So as long as the third party host (jQuery's or Google's in these cases) is up and running, your page will in many cases load faster.