Sunday, April 5, 2009

New features in Internet Explorer 8

Windows Internet Explorer 8 (abbreviated IE8) is the latest web browser developed by Microsoft. The Internet Explorer 8 is out, and clearly there have been some big advances since IE 7.

You can ask yourself : Why do I want to use Internet explorer 8?
The answer may be : because of new features and improvements.

So let's see new features:


  • Integrated developer tools


  • Do you want to debug jscript, inspect and edit HTML code directly from web browser? Now developers can debug a site's HTML, CSS, and Microsoft® JScript from within Internet Explorer 8 (with developer tools), rather than switch between Internet Explorer and a separate development environment. Developer tool exists in early versions of IE as a add-in, now it is integrated in IE 8. If you want to know more about developer tools visit article How to improve efficiency in web design with IE 8.


  • Increased performance


  • Internet Explorer 8 includes many performance improvements that contribute to a faster, more responsive web browsing experience in the areas that matter most. Internet Explorer 8 starts quickly, loads pages fast and instantly gets you started on what you want to do next with a powerful new tab page. In addition, the script engine in Internet Explorer 8 is significantly faster than in previous versions, minimizing the load time for webpages based on JavaScript or Asynchronous JavaScript and XML (AJAX).

    Google has commented on IE8 Beta 1 improvements (IE 8 team claim that Internet Explorer 8 is even faster since then):

    "Some of the tests we have done show pure JScript performance improvements up to 2.5 times. We also measured the performance gains on common Gmail operations, like loading the inbox (34%), opening a conversation (45%) and opening a thread (27%) compared to IE7."

    For more details about Internet Explorer 8 performance see article IE8 Performance.

    Microsoft published a report “Measuring the Performance of Browsers”. Published document explain the various benchmarking components and how they impact the performance, document also outline how to setup their own benchmarking environment to test browser performance. For further details Measuring the Performance of Browsers is available for download over the Microsoft download Website. Below is a result for first five webs from report "Measuring the Performance of Browsers".


    Summary of Browser Load Times (in seconds)

    Website

    Chrome 1.0

    Firefox 3.05

    IE 8

    google.com

    0.28

    0.22

    0.20

    yahoo.com

    2.15

    1.30

    1.32

    live.com

    3.48

    3.42

    3.40

    msn.com

    0.55

    0.97

    0.83

    youtube.com

    3.07

    2.80

    2.55



    If you don't believe Microsoft you should take a look at independent article Beta Browser Battle 2: Page-load times.


  • Accelerators


  • The new Accelerators in Internet Explorer 8 help you quickly perform your everyday browsing tasks without navigating to other websites to get things done. Simply highlight text from any web page, and then click on the blue Accelerator icon that appears above your selection to obtain driving directions, translate and define words, email content to others, search with ease, and more.

    For example you can use easily call accelerator Translate with Live Search in few clicks and get translated web page without navigating to Live Search page. You just need right click on visited web page, choose "Translate with Live Search", choose language and you will get translated page.

    Sample of using accelerator Translate with Live search

    You can find list of accelerators that you might want to add to your IE8 with their brief description here:


    Firefox users can find implementation of IE8 Activities (now called Accelerators) as Firefox Add-on which is near direct replication of Accelerators.


  • Enhanced navigation



    • Compatibility View

    • Internet Explorer 8 is a new release and some websites may not yet be ready for Internet Explorer 8. Click the Compatibility View toolbar button to display the website as viewed in Internet Explorer 7, which will correct display problems like misaligned text, images, or text boxes. This option is on a per site basis and all other sites will continue to display with Internet Explorer 8 functionality.

      Microsoft has provided a list of web sites that are most likely to be displayed better in Compatibility View in Windows Internet Explorer 8. This list have over 3,000 web sites.

      When users install Windows Internet Explorer 8, they have a choice about opting in to a list of sites that will be displayed in Compatibility View. Sites are listed on the Compatibility View list in response to feedback from other Internet Explorer 8 customers. Specifically, the feedback is based on the high-volume sites for which other users clicked the Compatibility View button. This list updates automatically and helps users who are not Web-savvy have a better experience with Web sites that are not yet Internet Explorer 8-ready.

    • Enhanced Tabbed Browsing

    • Internet Explorer 8 introduces Tab Groups, which make tabbed browsing easier. When one tab is opened from another, the new tab is placed next to the originating tab and color coded, so that you can quickly see which tabs have related content. If you close a tab that's part of a group, another tab from the same group is displayed, enabling you to remain within the context of the current task rather than suddenly looking at an unrelated site.

      Example of grouped tabs in IE 8

    • Better Find On Page


    • The toolbar is integrated below the tab row, so that it does not obscure any content on the page. Instead of waiting for you to type an entire search term and hit Enter, the toolbar searches character-by-character as you type. Matches are highlighted in yellow on the page so that they're easy to identify.

    • Smarter Address Bar


    • Type a few characters in the new Address Bar and Internet Explorer 8 will automatically recall sites you've already visited based on your entry. It searches across your History, Favorites, and RSS Feeds, displaying matches from the website address or any part of the URL. As you type, matched characters are highlighted in blue so you can identify them at a glance. In addition, you can delete any address in the drop-down box by clicking on the red X. This is especially useful for getting rid of misspelled URLs.


    • Improved Zoom


    • Adaptive Page Zoom improves upon traditional zoom-in/zoom-out functionality in the browser by intelligently relaying out the page content and eliminating the need to scroll left and right. This will improve your ability to magnify pages with small fonts and be able to read more on the web.



  • Improved favorites and history management



    • Enhanced Favorites Bar


    • Now there's a better place to keep track of your top favorites. You can save Favorites, RSS Feeds, and Web Slices to the Favorites bar that appears across the top of the browser, quickly navigating to the sites and content that you care about most.

      Favorites bar in IE 8


    • One Click Favorites


    • Press the One Click Add to Favorites bar button and immediately add the page you're browsing to the Favorites Bar, saving you extra clicks.

    • RSS feeds on Favorites bar


    • The Favorites bar has been updated so you can drag an RSS feed to your Favorites bar, making it easier to see when important feeds are updated.

    • History sorting


    • The new Browsing History view allows you to sort your history by Site Name, Most Visited Sites, Order Visited Today, and Date, making it easier to organize and locate sites in your history.

    • History searching


    • In Internet Explorer 8, you can search for pages in history by typing keywords, making it easier to locate sites when browsing your history.



  • Instant search


    • Search suggestions


    • The new search capabilities in Internet Explorer 8 will offer relevant suggestions as you type words into the search box to help save time. Click on a suggestion at any time to immediately execute the search without having to type the entire word or phrase.

    • Visual search


    • Internet Explorer 8 is partnering with top search providers like Live Search, Wikipedia, Yahoo, Amazon, and more to deliver "visual search" images that provide you with immediate answers. For example, typing "Obama" with Live Search will instantly show you a preview of the current weather directly in the Search Box drop-down. You can choose providers with click on "Find more providers". In picture bellow Wikipedia visual search is selected.

      Visual search in internet explorer 8


  • Web Slices


  • Using Web Slices, you can keep up with frequently updated sites directly from the new Favorites Bar. If a Web Slice is available on a page, a green Web Slices icon will appear in the upper-right hand corner of the browser. In this moment ebay site uses web slices. Click on this icon to easily subscribe and add the Web Slices to the Favorites Bar so you can keep track of that "slice" of the web.

    Add web slice from ebay

    After Web Slices is added you can click Web Slice on Favorites Bar to preview relevant information without visits web site. In example on those two pictures user track bids for laptop with help of Web Slice.

    Web Slice in favorites bar



  • Automatic crash recovery


  • If a website or add-on causes a tab to crash in Internet Explorer 8, only that tab is affected. The browser itself remains stable and other tabs remain unaffected, thereby minimizing any disruption to your browsing experience.
    If one or more of your tabs unexpectedly closes or crashes, your tabs are automatically reloaded and you are returned to the site you were on before the crash.


  • Browse privately



    • InPrivate Browsing


    • When checking e-mail at an Internet cafĂ© or shopping for a gift on a family PC, you don't want to leave any trace of specific web browsing activity. InPrivate Browsing in Internet Explorer 8 helps prevent your browsing history, temporary Internet files, form data, cookies, and usernames and passwords from being retained by the browser, leaving no evidence of your browsing or search history.

      You can start InPrivate Browsing by opening a new tab and selecting Browse with InPrivate or selecting it from the Safety button on the top right corner of the browser window. Once you complete this action, Internet Explorer 8 will launch a new browser session that won't record any information, including searches or webpage visits. To end your InPrivate Browsing session, simply close the browser window.

      Firefox fans can use Private Browsing 1.2.0 which enables not only private no history browsing, but the ability to clear certain, part or all of browsing history when closing Firefox. This will work in Firefox 3.0.8, however the Beta build of Firefox 3.1 has Private Browsing built right in.

    • InPrivate Filtering


    • Today websites increasingly pull content in from multiple sources, providing tremendous value to consumer and sites alike. Users are often not aware that some content, images, ads and analytics are being provided from third party websites or that these websites have the ability to potentially track their behavior across multiple websites. InPrivate Filtering provides users an added level of control and choice about the information that third party websites can potentially use to track browsing activity.

      InPrivate Filtering is off by default and must be enabled on a per-session basis. To use this feature, select InPrivate Filtering from the Safety menu. To access and manage different filtering options for Internet Explorer 8, select InPrivate Filtering Settings from the Safety menu. To end your InPrivate Browsing session, simply close the browser window.

For Firefox users I recommend very interested article Duplicate IE 8 Features in FireFox 3.

Related articles on this blog:
IE developer tools - integrated in IE 8


Related articles from other sources:
Microsoft Internet Explorer 8: the good the bad and the ugly


Thursday, April 2, 2009

jQuery selectors samples

jQuery selectors are one of the most important part of jQuery. Their main purpose is to allow users to quickly and easily identify and manipulate any set of page elements.
The selector is a string expression that identifes the set of DOM elements that will be collected into a matched set to be operated upon by the jQuery methods (but we will focus on selectors). In this article you will find samples of using jQuery selectors.

Basics



#id

Matches a single element with the given id attribute.

Sample:

$('#SelectMe')

This selector select element with id SelectMe.

<p id="SelectMe" style="display:none">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>





element

Matches all elements with the given name.

Sample:

$("p")

This selector select all paragraph (p) elements.

<p id="SelectMe" style="display:none">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<button id="butSelect">Select</button>


For example if we call:

$("p").toggle();

both paragraphs will be toggled.




.class

Matches all elements with the given class.

Sample:

$(".testClass")

This selector select all elements with class testClass.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<button id="butSelect" class="testClass">Select</button>




*

Matches all elements.

Sample:

$("*")

Matches all elements.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<button id="butSelect" class="testClass">Select</button>





selector1, selector2, selectorN


Matches the combined results of all the specified selectors.

Sample:

$("#SelectMe, .testClass")

This selector select element with id #SelectMe and elements with class testClass.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<button id="butSelect" class="testClass">Select</button>



Hierarchy




ancestor descendant

Matches all descendant elements specified by "descendant" of elements specified by "ancestor".

Sample:

$("div p")


This selector select all paragraph (p) elements which are in div element.

<div id="divToSelect">
<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<input id="testInput" />
</div>
<button id="butSelect" class="testClass">Select</button>



parent > child


Matches all child elements specified by "child" of elements specified by "parent".

Sample:

$("div > p")

This selector select all paragraph (p) elements which are in div element.

<div id="divToSelect">
<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<input id="testInput" />
</div>
<button id="butSelect" class="testClass">Select</button>



prev + next

Matches all next elements specified by "next" that are next to elements specified by "prev".

Sample:

$("p + input")

This selector select all input elements which are next to paragraph element.

<div id="divToSelect">
<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<p id="NotSelectMe">This paragraph will not be selected</p>
<input id="testInput" />
</div>
<button id="butSelect" class="testClass">Select</button>
<input id="noSelect" />




Selectors/siblings

Matches all sibling elements after the "prev" element that match the filtering "siblings" selector.

Sample:

$("#NotSelectMe ~ input")

This selector select all input elements after element with id NotSelectMe.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<input id="testInput" />
<p id="NotSelectMe">This paragraph will not be selected</p>

<input id="noSelect" />
<button id="butSelect" class="testClass">Select</button>



Basic filters



:first

Matches the first selected element.

Sample:

$("input:first")

This selector select first input element.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<input id="testInput" />
<p id="NotSelectMe">This paragraph will not be selected</p>
<input id="noSelect" />
<button id="butSelect" class="testClass">Select</button>



:last

Matches the last selected element.

Sample:

$("input:last")

This selector select last input element.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<input id="testInput" />
<p id="NotSelectMe">This paragraph will not be selected</p>
<input id="noSelect" />
<button id="butSelect" class="testClass">Select</button>



:not(selector)

Filters out all elements matching the given selector.

Sample:

$("input:not('#noSelect')")


This selector select all input element without element with id noSelect.

<p id="SelectMe" class="testClass">This paragraph will be selected</p>
<input id="testInput" />
<p id="NotSelectMe">This paragraph will not be selected</p>
<input id="noSelect" />
<button id="butSelect" class="testClass">Select</button>



:even

Matches even elements, zero-indexed.

Sample:

$("tr:even")

This selector select all even tr elements, zero-indexed.

<table border="1" class="style1">
<tr>
<td>
Row 0</td>
</tr>
<tr>
<td>
Row 1</td>
</tr>
<tr>
<td>
Row 2</td>
</tr>
<tr>
<td>
Row 3</td>
</tr>
</table>



:odd

Matches odd elements, zero-indexed.

Sample:

$("tr:odd")

This selector select all even tr elements, zero-indexed.

<table border="1" class="style1">
<tr>
<td>
Row 0</td>
</tr>
<tr>
<td>
Row 1</td>
</tr>
<tr>
<td>
Row 2</td>
</tr>
<tr>
<td>
Row 3</td>
</tr>
</table>



Related articles:
jQuery hello world
jQuery on blogspot (blogger) post
Basic web effect with jQuery


Tuesday, March 24, 2009

Basic web effect with jQuery

In this article you can find demos and sample code for basic effect functions in jQuery. We have: hide and show effect, fadeIn and fadeOut (disappearing) effect, slide down and slide up effect and animate effect. On my blog you can find more guides for cool javascript effects.

First you need to reference jQuery library (for more information see my first article about using jQuery.

Example:

<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>

Hide and show effect

Demo for show and hide function:




Code:
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#butShowHide').click(function()
{
$('#pShowHide').toggle();
});
});
</script>
<p id="pShowHide" style="display:none">This paragraph can be shown or hidden</p>
<button id="butShowHide">Show/Hide</button>


When butShowHide is clicked, toggle function is called on paragraph pShowHide.
Toggle function displaying matched elements. If they are shown, toggle makes them hidden. If they are hidden, toggle makes them shown.
There are also show and hide function. Toggle function is easier to use because you don't have to check if element is showed or hidden.




Demo for show and hide function with slow argument:



This div can be shown or hided slow


Code:
<script type="text/javascript">
$(document).ready(function(){
$("#butShowHideSlow").click(function () {

$("#divShowHideSlow").toggle("slow");
});
});
</script>
<button id="butShowHideSlow">Show and hide slowly</button>
<div style="width:300px;height:47px; border: solid 1px black;background-color:LightGrey;text-align:center;" id="divShowHideSlow">This div can be shown or hided slowly</div>


In this case we call toggle function with argument speed (toggle(speed)).
We set speed to slow.
Speed - A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).



FadeIn and FadeOut effect

Demo for fade in and fade out:

  

This paragraph can fade in and fade out


Code
<script type="text/javascript">
$(document).ready(function(){
$("#butFadeOut").click(function () {
$("#pFadeInOut").fadeOut(3000);
});

$("#butFadeIn").click(function () {
$("#pFadeInOut").fadeIn(3000);
});
});
</script>

<button id="butFadeOut">Fade Out</button>&nbsp;&nbsp;<button id="butFadeIn">Fade In</button>
<br />
<p id="pFadeInOut">This paragraph can fade in and fade out</p>



When button butFadeOut is clicked fadeOut function is called on paragraph pFadeInOut
fadeOut(3000) - fadeOut effect will run for 3 seconds.

When button butFadeIn is clicked fadeIn function is called on paragraph pFadeInOut.
fadeIn(3000) - fadeIn effect will run for 3 seconds.



Slide up and Slide down

Demo for slide up and slide down:



This toggle can be slide up and down


Code:
<script type="text/javascript">
$(document).ready(function(){
$('#butSlide').click(function () {
$('#divSlide').slideToggle("slow");
});
});
</script>

<button id="butSlide">Slide up/down</button>
<br />
<div style="width:300px;height:47px; border: solid 1px black;background-color:LightGrey;text-align:center;" id="divSlide">This toggle can be slide up and down</div>


When button butSlide is clicked slideToggle function is called on div divSlide with argument slow.

slideToggle(speed) - Toggle the visibility of all matched elements by adjusting their height.


Animate effect

Demo for animate:

   


This paragraph can move left and right




Code:

<script type="text/javascript">
$(document).ready(function(){
$("#butLeft").click(function () {
$("#pMovingParagraph").animate({"left": "-=50px", "opacity": 1}, 500);
});

$("#butRight").click(function () {
$("#pMovingParagraph").animate({"left": " =50px", "opacity": 1}, 500);
});
});
</script>

<button id="butLeft">move left</button>&nbsp;&nbsp;&nbsp;<button id="butRight">move right</button>


When button butLeft is clicked animate function is called on paragraph pMovingParagraph.

When button butRight is clicked animate function is called on paragraph pMovingParagraph.

animate( params, [duration])

params - A set of style attributes that you wish to animate, and to what end.

duration - A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).


Related articles:
jQuery hello world
jQuery on blogspot (blogger) post
jQuery selectors samples

Saturday, March 14, 2009

jQuery on blogspot (blogger) post

You find some cool jQuery features but don't know how to include jQuery code into your blogspot blog? Here you will find two steps needed to jQuery work on your blog.

Two steps for implement jQuery on blogspot post


  1. Reference jQuery library in your blogspot post

  2. To provide jQuery work you must reference jQuery library. One option is to reference on jquery-1.3.2.min.js file on google code.

    <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>


    Another option is to upload jquery library file somewhere on the web (look here for advices about uploading files for blogspot) and reference it on blogspot (on blogspot you can upload only images).


  3. jQuery code and style code should be in one line

  4. Example of jQuery code (in this form it will not function on blogger):

    <script type="text/javascript">
    $(function()
    {
    $("#butToggle").click(function()
    {
    $('#dvt').toggle(1000);
    });
    });
    </script>


    This jQuery code (above) should look like this to work on blogspot:

    <script type="text/javascript">$(function(){$("#butToggle").click(function(){$('#dvt').toggle(1000);});});</script>


    Example of style code (in this form it will not function on blogger):

    <style type="text/css">
    #dvt
    {
    width: 200px;
    height: 100px;
    border: solid 1px black;
    background-color:LightGrey;
    text-align:center;
    display:none;
    }
    </style>


    Style code should be like this to work on blogspot:






This demo show jQuery that works on blogger.When you click toggle button div is shown or hidden.

This works on blogger



And here is code needed for this demo that should be in blogspot post:

<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){$("#butToggle").click(function(){$('#dvt').toggle(1000);});});</script>

<style type="text/css">#dvt{width: 200px;height: 100px;border: solid 1px black;background-color:LightGrey;text-align:center; display:none;}</style>

<div id="dvt">This works on blogger</div>
<button id="butToggle">Toggle</button>


Related articles:
Add javascript in blogspot (blogger) post
jQuery hello world
jQuery selectors samples

Tuesday, March 10, 2009

jQuery hello world

This text contain brief tutorial how to use jQuery on your web and have one demo and one short and simple example.

First let's see what is jQuery?
jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML. jQuery is designed to change the way that you write Javascript.

To use jQuery you must have access to jQuery library. You can find jQuery library on http://jquery.com/. Choose production and download file.

jQuery download

To use jQuery you need to reference it on your page.

Example:

<script src="jquery-1.3.2.min.js" type="text/javascript"></script>

There is jquery-1.3.2.min.js file but the next version will have different name (probably jquery-1.3.3.min.js) so you will must change name of the file when there will be newer version. This work when you have Jquery library in same directory as your html page.

Another option is to reference jQuery library directly from google code.

Example:

<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>

Demo of disappearing paragraph with jQuery:


Example of Jquery, click paragraph
and it will fade away.



Code for disappearing paragraph with jQuery:


<html>
<head>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script>
(function(){
$("#paragraph1").click(function () {
$("#paragraph1").fadeOut("slow");
});

});
</script>
<style>
#paragraph1 { font-size:150%; cursor:pointer; }
</style>
</head>
<body>
<p id="paragraph1">
Example of Jquery, click paragraph
and it will fade away.
</p>
</body>
</html>


We have reference to jQuery library (see above for explanation)

<script src="jquery-1.3.2.min.js" type="text/javascript"></script>


There is paragraph with id paragraph1

<p id="paragraph1">
Example of Jquery, click paragraph
and it will fade away.
</p>



With this we determine style for element with id paragraph1.
<style>
#paragraph1 { font-size:150%; cursor:pointer; }
</style>



This code says :
when paragraph1 is clicked ( $("#paragraph1").click(function ())
then fadeOut method is called with parameter slow ($("#paragraph1").fadeOut("slow");).

<script>
(function(){
$("#paragraph1").click(function () {
$("#paragraph1").fadeOut("slow");
});
});
</script>


In the end paragraph disappear after user click on it. Instead parameter slow can stand normal or fast. Or time in miliseconds.

Related articles:
jQuery on blogspot (blogger) post
jQuery selectors samples
Basic web effect with jQuery