Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Peter Cooperx http://www.petercooper.co.uk/

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

How to create a OpenSearch reference for your site (as used by Firefox 2's search box)

Create a file like this one as used for Wikipedia, but that refers to your own site's search:

<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Wikipedia (English)</ShortName>
<Description>Wikipedia (English)</Description>
<Image height="16" width="16" type="image/x-icon">http://en.wikipedia.org/favicon.ico</Image>
<Url type="text/html" method="get" template="http://en.wikipedia.org/w/index.php?title=Special:Search&amp;search={searchTerms}"/>
<Url type="application/x-suggestions+json" method="GET" template="http://en.wikipedia.org/w/api.php?action=opensearch&amp;search={searchTerms}"/>
</OpenSearchDescription>


Then link to it from your pages like so:

<link rel="search" type="application/opensearchdescription+xml" href="/w/opensearch_desc.php" title="Wikipedia (English)" />

Let user add your search engine to their Firefox search bar

Built your own queryable search engine? Let FireFox users easily add it to their search box with this on an HTML page:

<a href="javascript:window.sidebar.addSearchEngine('http://yoursrcfile.src','http://yourpngfile.png','Name','Type Of App');">Click here to add my search engine</a>


And you have to make those 'src' and PNG icon files too.. the 'src' file has a syntax like this:

<search name="YourSite" description="" method="GET" 
action="http://www.yoursite.whatever/search" 
searchForm="url-to-your-actual-search-form" queryEncoding="UTF-8" 
queryCharset="UTF-8">
<input name="sourceid" value="FireFox-Search-Box">
<input name="q (or whatever your preferred arg is)" user=""><inputprev>
</search>

<browser update="URL back to this SRC file" updateIcon="URL to your PNG" 
updateCheckDays="30">


More info here.

Making bordercolor work in FireFox / Mozilla

IE and Safari support the bordercolor attribute directly on TABLE elements which colors the external and internal borders. FireFox does not, but you can use standard CSS to fix it.

TABLE { border: 1px solid #eee; }
TABLE TD { border: 1px solid #eee; }


Unlike most solutions, this also correctly changes the color of the cell borders.
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS