Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
Create your own Google toolbar for IE

 
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum
Author Message
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Create your own Google toolbar for IE Reply with quote

The "script language" tags MUST stay in the .js files.

This involves making changes to your registry, as with all changes to the registry it is recomended that you backup your system prior to trying this.

To add "Google search" to your IE context menu like firefox has, here's how.

According to Microsoft, this method of adding context items should work as early as IE4.

Open notepad and paste this, (NOTE: You can change the paths to the js files if you want, just make sure you put the files where this says they are.)

Code:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Google As Is]
@="C:\\google_context_noquote.js"
"Contexts"=hex:10

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Google w/Quotes]
@="C:\\google_context_quote.js"
"Contexts"=hex:10

Save as a .REG file, right-click and select merge.

Now paste theese two sniplets and save as the two js files that the reg file points to.

google_context_noquote.js

Code:
<script language="javascript">
// Get the window object where the context menu was opened.
var oWindow = window.external.menuArguments;

// Get the document object exposed through oWindow.
var oDocument = oWindow.document;

// Get the selection from oDocument.
var oSelect = oDocument.selection;

// Create a TextRange from oSelect.
var oSelectRange = oSelect.createRange();

// Get the text of the selection.
var sNewText = oSelectRange.text;

// Build Google QueryString
var googleQ = "http://www.google.com/search?&q=" + sNewText;

// Ask Google
oWindow.open(googleQ);
</script>


google_context_quote.js

Code:
<script language="javascript">
// Get the window object where the context menu was opened.
var oWindow = window.external.menuArguments;

// Get the document object exposed through oWindow.
var oDocument = oWindow.document;

// Get the selection from oDocument.
var oSelect = oDocument.selection;

// Create a TextRange from oSelect.
var oSelectRange = oSelect.createRange();

// Get the text of the selection.
var sNewText = oSelectRange.text;

// Build Google QueryString
var googleQ = "http://www.google.com/search?&q=%22" + sNewText + "%22";

// Ask Google
oWindow.open(googleQ);
</script>


This will cause two new options to show up in the same menu that pops up when you have selected some text.

"Google As Is" sends a query to google with the selected text just as it is, no quotes.

"Google w/Quotes" does the same as above except it places quotes aroung the selected text.

You only need to restart your browser to get this to start working.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.


Last edited by quantum on Mon Aug 09, 04 1:31 pm; edited 1 time in total
Sat Jun 12, 04 12:00 pm
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
dude
Power User
Power User


Joined: 10 Mar 2004
Posts: 376
Location: Savar, Dhaka

Post Post subject: Reply with quote

Why will I want to make it myself? Google already made it for me. I will just download it from here.

[http://toolbar.google.com/]
Wed Jun 16, 04 4:18 am
Back to top
dude View user's profile Send private message Visit poster's website
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

Comeon Dude. Don't you have any curiosity how something is done?
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Sun Jun 20, 04 12:55 pm
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group