Archive for the ‘ Miscellaneous ’ Category

query string split from url in javascript


function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split(“&”);
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
alert( getQueryVariable("val") );
//www.test.com/dsd?val=sdf%20sdf

Advertisements

Screen width & Detect Safari browser in Javascript


////// get screen width ////////
var scr = screen.width;
if(scr>1024){
//test
}

////// detect user safari browser ////////
var browser = navigator.userAgent;
if (browser.toLowerCase().indexOf(‘safari’) > 0){
//detect browser
}

Firefox Only Print One Page Bug


As a web developer, you will come across various problems related to your web site. A few weeks ago, I was told that my web page only printed one page. Strange, the screen displays a large table set that expands ~4 pages.

And the kicker, it does this on Firefox. Wow. After a few minutes of googling, I have discovered the culprit to be within CSS. Here was my simple solution.

Print.css

Create a new style sheet made for print. It’s best to include this right below all your other style sheets, so it can overwrite any elements right before the user prints.

1.<link rel="stylesheet" type="text/css" media="all" href="style.css" />
2.<link rel="stylesheet" type="text/css" media="print" href="print.css" />

Ok Batman, let’s override some code.

for more information click here : http://htmltree.com/firefox-only-print-one-page-bug/#more-6

The Internet Explorer 6 Countdown


IE610 years ago a browser was born.
Its name was Internet Explorer 6. Now that we’re in 2011, in an era of modern web standards, it’s time to say goodbye.

This website is dedicated to watching Internet Explorer 6 usage drop to less than 1% worldwide, so more websites can choose to drop support for Internet Explorer 6, saving hours of work for web developers.

 Check the Internet Explorer 6 usage around the world

Useful handles in Magento


Some useful layout handles in Magento—the identifiers which allow you to single out a particular page or section of your Magento store are as follows:

XML handle  Page it identifies in Magento  XML layout file the XML handle is referenced in 
catalog_category_default  The default view for a category of products.  catalog.xml 
customer_account  The customer account page, shown when a customer is logged in to their account on your store.  customer.xml 
catalog_product_view  The product page view (that is, a page which displays an individual product).  catalog.xml 
cms_page  Pages created with Magento’s content management system.  cms.xml 
checkout_cart_index  The checkout’s ‘index’ (that is, default) view  checkout.xml 
cms_index_defaultnoroute  The default error page for the 404 ‘not found’ error  cms.xml 
cms_index_defaultindex  The homepage of your Magento store  cms.xml 

2011 Japanese Earthquake and Tsunami



An aerial view shows tsunami damage and flooding in Natori city in Miyagi Prefecture on Saturday. More than 1,000 people were feared dead after a monster tsunami was unleashed by a magnitude 8.9 quake. Continue reading

Gary Flake: is Pivot a turning point for web exploration?


About this talk :
Gary Flake demos Pivot, a new way to browse and arrange massive amounts of images and data online. Built on breakthrough Seadragon technology, it enables spectacular zooms in and out of web databases, and the discovery of patterns and links invisible in standard web browsing.

For more ideas :  http://www.ted.com/