Category: Browser


from http://www.seopher.com/articles/fixing_the_permission_denied_to_get_property_xulelement_selectedindex_error

If you’re ever doing some AJAX stuff with a text-box input it’s possible that your Firebug will throw a very unusual error:

Error: [Exception… “‘Permission denied to get property XULElement.selectedIndex’ when calling method:

The problem lies in Firefox specifically and it’s autocomplete functionality. To fix it all you need to do is update your input field with the following code:

<input type=”text” autocomplete=”off”>

The autocomplete bit of code stops Firefox from attempting to complete the content in the box (thus throwing off the DOM or something). It’s not XHTML 1.0 transitional complient but it does stop Firefox from throwing errors.

Useful HTML Meta Tags

Tag Name Example(s) Description
Author <META NAME=”AUTHOR” CONTENT=”Tex Texin”> The author’s name.
cache-control <META HTTP-EQUIV=”CACHE-CONTROL” CONTENT=”NO-CACHE”> HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.
Public – may be cached in public shared caches
Private – may only be cached in private cache
no-Cache – may not be cached
no-Store – may be cached but not archivedThe directive CACHE-CONTROL:NO-CACHE indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the PRAGMA:NO-CACHE.
Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.
Also see EXPIRES.
Note: It may be better to specify cache commands in HTTP than in META statements, where they can influence more than the browser, but proxies and other intermediaries that may cache information.
Content-Language <META HTTP-EQUIV=”CONTENT-LANGUAGE”
CONTENT=”en-US,fr”>
Declares the primary natural language(s) of the document. May be used by search engines to categorize by language.
CONTENT-TYPE <META HTTP-EQUIV=”CONTENT-TYPE”
CONTENT=”text/html; charset=UTF-8″>
The HTTP content type may be extended to give the character set. It is recommended to always use this tag and to specify the charset.
Copyright <META NAME=”COPYRIGHT” CONTENT=”&copy; 2004 Tex Texin”> A copyright statement.
DESCRIPTION <META NAME=”DESCRIPTION”
CONTENT=”…summary of web page…”>
The text can be used when printing a summary of the document. The text should not contain any formatting information. Used by some search engines to describe your document. Particularly important if your document has very little text, is a frameset, or has extensive scripts at the top.
EXPIRES <META HTTP-EQUIV=”EXPIRES”
CONTENT=”Mon, 22 Jul 2002 11:12:01 GMT”>
The date and time after which the document should be considered expired. An illegal EXPIRES date, e.g. “0″, is interpreted as “now”. Setting EXPIRES to 0 may thus be used to force a modification check at each visit.
Web robots may delete expired documents from a search engine, or schedule a revisit.HTTP 1.1 (RFC 2068) specifies that all HTTP date/time stamps MUST be generated in Greenwich Mean Time (GMT) and in RFC 1123 format.
RFC 1123 format = wkday “,” SP date SP time SP “GMT”

wkday = (Mon, Tue, Wed, Thu, Fri, Sat, Sun)
date = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982)
time = 2DIGIT “:” 2DIGIT “:” 2DIGIT ; 00:00:00 – 23:59:59
month = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)

Keywords <META NAME=”KEYWORDS”
CONTENT=”sex, drugs, rock & roll”>
The keywords are used by some search engines to index your document in addition to words from the title and document body. Typically used for synonyms and alternates of title words. Consider adding frequent misspellings. e.g. heirarchy, hierarchy.
PRAGMA NO-CACHE <META HTTP-EQUIV=”PRAGMA” CONTENT=”NO-CACHE”> This directive indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the CACHE-CONTROL:NO-CACHE directive and is provided for backwards compatibility with HTTP/1.0.
Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.
HTTP/1.1 clients SHOULD NOT send the PRAGMA request-header. HTTP/1.1 caches SHOULD treat “PRAGMA:NO-CACHE” as if the client had sent “CACHE-CONTROL:NO-CACHE”.
Also see EXPIRES.
Refresh <META HTTP-EQUIV=”REFRESH”
CONTENT=”15;URL=http://www.I18nGuy.com/index.html”>
Specifies a delay in seconds before the browser automatically reloads the document. Optionally, specifies an alternative URL to load, making this command useful for redirecting browsers to other pages.
ROBOTS <META NAME=”ROBOTS” CONTENT=”ALL”>

<META NAME=”ROBOTS” CONTENT=”INDEX,NOFOLLOW”>

<META NAME=”ROBOTS” CONTENT=”NOINDEX,FOLLOW”>

<META NAME=”ROBOTS” CONTENT=”NONE”>

CONTENT=”ALL | NONE | NOINDEX | INDEX| NOFOLLOW | FOLLOW | NOARCHIVE
default = empty = “ALL”
“NONE” = “NOINDEX, NOFOLLOW”
The CONTENT field is a comma separated list:
INDEX: search engine robots should include this page.
FOLLOW: robots should follow links from this page to other pages.
NOINDEX: links can be explored, although the page is not indexed.
NOFOLLOW: the page can be indexed, but no links are explored.
NONE: robots can ignore the page.
NOARCHIVE: Google uses this to prevent archiving of the page. See http://www.google.com/bot.html
GOOGLEBOT <META NAME=”GOOGLEBOT” CONTENT=”NOARCHIVE”> In addition to the ROBOTS META Command above, Google supports a GOOGLEBOT command. With it, you can tell Google that you do not want the page archived, but allow other search engines to do so. If you specify this command, Google will not save the page and the page will be unavailable via its cache.
See Google’s FAQ.

from http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r_2.html

As we all know an xmlhttp script requires the use of the readystatechange event. In theory, using the load event is also possible, but Explorer doesn’t support it on xmlhttp requests.

Both these events, and the readyState property, have a few odd quirks when used in an xmlhttp environment, though. These quirks don’t impact standard xmlhttp scripts too much, but as soon as you want to use the event objects or readyStates other than 4 you need to know about them.

readyState

The readystatechange event fires when the readyState of the request changes. This property can have four values, which theoretically work in the way shown below. In practice, though, the browsers don’t quite follow this de facto standard.

0 Uninitialized – open() has not been called yet.
1 Loading – send() has not been called yet.
2 Loaded – send() has been called, headers and status are available.
3 Interactive – Downloading, responseText holds the partial data.
4 Completed – Finished with all operations.

readyState 4 is equivalent to the load event and is a standard part of any xmlhttp script. I have never understood what the other three readyStates are good for; why would you need to know that responseText holds the partial data, for instance? One more mystery to solve.

That said, let’s try the following bit of script. You’d expect four alerts, 1, 2, 3 and 4.

xmlhttp.open("GET","somepage.xml",true);
xmlhttp.onreadystatechange = checkData;
xmlhttp.send(null);

function checkData()
{
	alert(xmlhttp.readyState);
}

Results:

  • Explorer: 1-2-3-4 (correct)
  • Mozilla: 1-2-3-4 (correct)
  • Safari: 2-3-4
  • Opera: 3-4

Where have the missing readyStates gone in Safari and Opera? I have no idea.

Let’s move the event handler assignment to a different point in the code:

xmlhttp.onreadystatechange = checkData;
xmlhttp.open("GET","somepage.xml",true);
xmlhttp.send(null);

Results:

  • Explorer: 1-1-2-3-4
  • Mozilla: 1-1-2-3-4
  • Safari: 1-2-3-4 (correct)
  • Opera: 1-3-4

All browsers now add an extra readyState of 1 at the start of their sequence. Explorer and Mozilla give a “1″ alert twice, and that’s odd, because the event name is clearly readystatechange and a change from 1 to 1 is no change. Opera still lacks the readyState 2. Odd, odd.

Let’s move the event handler assignment again:

xmlhttp.open("GET","somepage.xml",true);
xmlhttp.send(null);
xmlhttp.onreadystatechange = checkData;

Explorer doesn’t react at all if you assign the readystatechange event after the send() method has been called.

  • Explorer: nothing
  • Mozilla: 2-3-4 (correct)
  • Safari: 2-3-4 (correct)
  • Opera: 3-4

In conclusion, no browser correctly supports readyState in all cases. Fortunately the all-important value of 4 is unaffected by this odd series of bugs.

readystatechange

Let’s consider the events themselves:

xmlhttp.open("GET","somepage.xml",true);
xmlhttp.onreadystatechange = checkData;
xmlhttp.send(null);

function checkData(e)
{
	var evt = e || window.event;
	var rs = xmlhttp.readyState || "None";
	alert(evt.type + ' ' + rs);
}

Now you’d expect to get an alert “readystatechange 1″ through 4. Unfortunately only Safari gives this correct response, even though it starts at readyState 2, as we saw above.

  • Explorer: “load 1″, then sometimes error messages, sometimes the “load 2″ through 4 you’d expect. Right now I think the error messages come when the XML document is being really loaded, and the 2 through 4 when Explorer can get the XML document from the cache.
  • Mozilla: error message: event object doesn’t exist
  • Safari: “readystatechange 2″ through 4
  • Opera: error message: event object doesn’t exist

The readystatechange event object is entirely absent in Mozilla and Opera, while Explorer feels its type is a load event.

Another related point:

When you use synchronous loading in Mozilla (ie. browser waits until the XML file has been loaded before doing anything else), the readystatechange event is not available.

This is not a huge problem, because the idea behind synchronous loading is that you wait for the XML file to be available, anyway. The line after the xmlhttp.send(null) is executed only when the XML is there. Nonetheless this point should be noted, too.

load

Explorer has a point in so far as the load event can be seen as a subset of the readystatechange event. load fires when the page has been loaded completely, which is equivalent to saying the readyState is 4: completed.

Let’s try it:

xmlhttp.open("GET","somepage.xml",true);
xmlhttp.onload = checkData;
xmlhttp.send(null);

function checkData(e)
{
	var evt = e || window.event;
	var rs = xmlhttp.readyState || "None";
	alert(evt.type + ' ' + rs);
}
  • Explorer: error message because you assign the unknown property onload to the xmlhttp request
  • Mozilla: “load 4″
  • Safari: “load 4″
  • Opera: error message: event object doesn’t exist

So Explorer doesn’t support the load event on xmlhttprequests. We already knew this, but we should realize it doesn’t even allow you to set the event handler, since it allows only a very limited set of properties on the xmlhttp object.

The event object is still missing in Opera, though not in Mozilla.

Problem:

When doing AJAX call, IE will cache every AJAX call. Hence, url such as ‘/post.do’ will return the same thing and actually the AJAX request will not be sent after the first time.

Solution:

put AJAX url ‘/post.do’ with a time stamp as following:

jQuery.get('/post.do?ts='+(new Date()).getTime());

from http://www.davidtan.org/tips-reduce-firefox-memory-cache-usage/

Sometimes I just feel that Firefox is such a memory hog. Once I start to open up a few extra tabs, it starts to slow down my whole system. Fortunately, you can do something about it. Here are simple tips and tricks to reduce firefox memory and cache consumption.

Tip 1: Reduce session history
browser.sessionhistory.max_entries determines the maximum number of pages in the browser’s session history, i.e. the maximum number of URLs you can traverse purely through the Back/Forward buttons. The Default value is 50.
We usually won’t surf more than 5 of the websites we previously surfed before, and there is really no need to store more than that in the session which can clog up memory as they grow.
1. Open Firefox
2. Type about:config in the Firefox address bar
3. Press CTRL-F and search for browser.sessionhistory.max_entries
4. Double click on the value 50 (or whatever value is there currently) and change it to something lower such as 5.
5. Restart Firefox.

For Firefox 1.5 and above, you can also look at another configuration variable browser. sessionhistory. max_total_viewers which also determines the maximum number of content viewers to cache for “bfcache” (fast back/forward navigation). Default value is -1 (calculate based on available memory).
Set it to 0 so that no pages will be stored in memory.
set it to a number such as 5 to store only 5 pages in memory.
more info here

Tip 2: Reduce memory usage when minimize
1. Start up Firefox
2. Type in about:config in the address bar and hit Enter
3. Right click and choose New > Boolean
4. Type config.trim_on_minimize in the pop-up box and hit Enter
5. Select True and hit Enter.
6. Restart Firefox

Tip 3: Fixed cache capacity OR Disable Cache Totally
Every time new page is loaded, Firefox will cache the page so it doesn’t need to load again to be redisplayed. By default, this setting is set to -1 for browser.cache.memory.capacity and to a number you specified in Tools -> Options -> Advanced -> Network / Cache for browser.cache.disk.capacity

To fix your cache to a certain value:
*browser.cache.memory.enable and browser.cache.disk.enable needs to be True for this to work
1. Start up Firefox
2. Type about:config in the address bar and hit Enter
3. Search for browser.cache.memory.capacity and set a number in KB to use for the memory cache (ie. 1024KB = 1MB).
4. Search for browser.cache.disk.capacity and set a number in KB to use for the disk cache (ie. 1024KB = 1MB).

To Disable the cache Totally
Set both browser.cache.memory.capacity and browser.cache.disk.capacity to 0.
Alternatively, you can also set browser.cache.disk.enable and browser.cache.memory.enable to False.

Tip 4: Use less extension and themes
This is really a no brainer. Uninstall all firefox extensions and themes that you don’t use as they can cause Firefox to use more RAM. If you think that you might still need the extension in future but not using it currently, at least there’s an option to Disable it. Use only extensions that you usually use to cut down memory usage.

Always upgrade your extensions and themes to the latest version as they may fix the some problems leading to memory leaks. Firefox makes this quit easy as it now does the checking for you, all you need is to do is tick some checkboxes and your plugins and themes wil be updated.

Tip 5: Check Firefox Memory Usage
Type about:cache?device=memory in the address bar and hit Enter. Firefox will display your current number of entries, maximum storage size, storage in use and inactive storage.

There you have it. Happy browsing!

Just discover that when coding the following into style sheet:


table {
  border-collapse: collapse;
}
th, td {
  position: relative;
  border: 1px solid #eee;
}

In Firefox 3, top and right borders of each table cell will disappear.

In IE 7, borders could not collapse.

Don’t know why this happened, need to do a little bit more research.

Fix for PNG issue in IE6

Well known issus that IE6 can not display transparency for PNG picture. But now here comes the IFixPNG from http://jquery.khurshid.com/ifixpng.php. It’s really a perfect fix for this issue…

Generally, it is caused by the following situations:

  • img, iframe, and frame with src attribute which is blank or non found items.
  • any request from non-secure (non https) source.
  • any usage of ‘about:’ such as about:blank

Trouble shooting:

  • examine any src attribute of img, iframe and frame carefully

Solution:

  • change src attribute to ‘javascript:false;’ or a ‘blank.html’

Browsers which have this issue:

  • IE 6 and below

Read more from here.

Gears in Firefox

Just a note of gears in Firefox which will help a great deal in facilitating your web development.

Firebug: very handy extension which will help in figuring out the CSS and Javascript bugs.

YSlow: Y(Why) slow? It’s a really a good name which will clearly identify the performance problems in your web page. Why Google pages can response in seconds? YSlow will tell you the secret. For more information on this topic, go to YSlow support.

Live HTTP Headers: for those who feel more comfortable of working with http headers, this is it! Different from Firebug which provides console monitoring for Ajax interaction, Live HTTP Headers can give you more!

About protocol links

From http://kb.mozillazine.org/About_protocol_links

There are a few special URLs, which begin with about:, that you can type into the Location Bar. (In Thunderbird, which has no Location Bar, or in SeaMonkey, you can also use them as “Mail Start Page”.)

  • about: — The same page as “Help -> About”.
  • about:about — Lists all these about: URLs (Mozilla Suite/SeaMonkey only).
  • about:blank — A blank page. Useful for setting as your homepage.
  • about:bloat — Displays BloatView output (disabled in release builds).
    • about:bloat?new
    • about:bloat?clear
  • about:buildconfig — Reveals details about your Mozilla build options.
  • about:cache — Displays cache statistics and disk cache directory location.
    • about:cache?device=memory — Lists memory cache entries.
    • about:cache?device=disk — Lists disk cache entries.
  • about:cache-entry — Shows information about a cache entry. Used in about:cache links. Requires parameters.
  • about:config — GUI for modifying user preferences.
  • about:crashes — List of Breakpad crash reports, with links and datestamps. Only in products based on Gecko 1.9 or later (Firefox 3, Thunderbird 3, SeaMonkey 2).
  • about:credits — The list of contributors to the Mozilla projects.
  • about:logo — Displays the application logo (Mozilla Suite, SeaMonkey, and Firefox 3).
  • about:kitchensink — Was never included in Mozilla for the reasons listed in Bug 122411 (“Mozilla does not have a kitchen sink”). You can install an extension that adds it though :)
  • about:license — shows the Mozilla Public License and the Netscape Public License for the piece of software. ( Only in products based on Gecko 1.8 or later)
  • about:mozilla — The famous Book of Mozilla.
  • about:plugins — Lists all your plugins as well as other useful information.
  • about:robots — Easter egg, see bug 417302. Beginning with March 8th, 2008 trunk builds, it’s now available on Firefox 3.0b5..

Extensions

Certain extensions add a few additional about: URLs.

External Links

Powered by WordPress. Theme: Motion by 85ideas.