Created
September 19, 2014 14:36
-
-
Save bpteam/4e12ff77813d2fa40827 to your computer and use it in GitHub Desktop.
add custom search to browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:addOpenSearch();">Add search</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addOpenSearch(name,ext,cat,pid,meth){ | |
if ( | |
(typeof window.external == "object") && | |
((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function")) | |
) { | |
if ((typeof window.external.AddSearchProvider == "unknown") && meth == "p") { | |
alert("This plugin uses POST which is not currently supported by InternetExplorer's implementation of OpenSearch."); | |
} else { | |
window.external.AddSearchProvider( | |
"http://path/to/xml"); | |
} | |
} else { | |
window.location="url/after/error"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf8"?> | |
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> | |
<ShortName>Title your search</ShortName> | |
<Description>Description your search</Description> | |
<Contact>your email</Contact> | |
<Url type="text/html" template="http://your.site/?search_query={searchTerms}" /> | |
<LongName>Long name your search</LongName> | |
<Image height="64" width="64" type="image/png">http://your.site/images/img/favicon.gif</Image> | |
<Image height="16" width="16" type="image/vnd.microsoft.icon">http://your.site/favicon.ico</Image> | |
<Developer>who make it</Developer> | |
<Attribution></Attribution> | |
<SyndicationRight>open</SyndicationRight> | |
<AdultContent>false</AdultContent> | |
<Language>ru-ru</Language> | |
<OutputEncoding>utf8</OutputEncoding> | |
<InputEncoding>utf8</InputEncoding> | |
</OpenSearchDescription> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment