Web Analytics Made Easy -
StatCounter Search option in right-click menu - CodingForum


No announcement yet.

Search option in right-click menu

  • Filter
  • Time
  • Show
Clear All
new posts

  • Search option in right-click menu

    Hey all,

    In Internet Explorer, and every other browser I've looked at, there is a find option under the edit menu. When you right-click a webpage, I'd like to be able to have that find/search option show up on that right-click menu.

    I know that you can change the right-click menu using javascript. What I'm unclear on is whether we have access to that find routine somehow.

    I have a popup window that I've disallowed the menubar and toolbars and all that stuff. But I do want to be able to search this page now.

    The right-click menu was a first thought that would be quite user-friendly (I think...). But if anyone has any other ideas, I'd be open to hearing them.


  • #2
    In NS, you can activate the Edit-Find using window.find() method. But I think there's no built-in method in IE to call the Find function. Long time ago, I found a script that simulates that functionality in IE but unfortunately, I can't find it in my disk nor remember where it came from.
    vBulletin Mods That Rock!


    • #3
      I unsuccessfully tried to do this myself to use with an editor I made.
      Although I know the find panel is here:

      I all could ever do was flash my monitor.
      But sadly no Find Panel.

      Below are several thngs I tried.
      Perhaps these examples will assist you in finding the find.

      <title>Looking for Find Panel</title> 
      <script type="text/JScript"> 
      var v = new ActiveXObject("Shell.Application"); 
      <a href="javascript&#58;v.ShellExecute('find.exe', '', 'C:\\WINDOWS\\system32');">Find Panel</a><br> 
      In: C:\\WINDOWS\system32\find.exe<br> 
      (I think this is it) 
      <a href="javascript&#58;v.ShellExecute('wmplayer.exe', '', 'C:\\Program Files\\Windows Media Player');">Windows Media Player</a><br> 
      In: C:\\Program Files\Windows Media Player\wmplayer.exe<br> 
      (if you have it there)<br> 
      <a href="javascript&#58;v.ShellExecute('Notepad');">Notepad</a><br> 
      In: C:\\WINDOWS\system32\notepad.exe<br> 
      <TITLE>Start Page</TITLE> 
      <OBJECT ID="oShell" 
          INPUT {width: 200} 
      <SCRIPT LANGUAGE="VBScript"> 
        function fnStart(sMethod) 
          select case sMethod 
            case 0    
                'Minimizes all windows on the desktop 
            case 1  
                'Displays the Run dialog box 
            case 2  
                'Displays the Shut Down Windows dialog box 
            case 3  
                'Displays the Find dialog box 
            case 4  
                'Displays the Date/Time dialog box 
            case 5  
                'Displays the Internet Properties dialog box 
              oShell.ControlPanelItem "INETCPL.cpl" 
            case 6  
                'Explores the My Documents folder 
              oShell.Explore "C:\My Documents" 
            case 7  
                'Enables user to select folder from Program Files 
              oShell.BrowseForFolder 0, "My Programs", 0, "C:\Program Files" 
            case 8  
                'Opens the Favorites folder 
              oShell.Open "C:\WINDOWS\Favorites" 
            case 9  
                'Displays the Taskbar Properties dialog box 
            case 10  
                'Opens the Find Panel 
              oShell.Open "C:\WINDOWS\system32\find.exe" 
          end select  
        end function      
      <INPUT type="button" value="Open Find Panel" onclick="fnStart(10)">        
      <INPUT type="button" value="Edit Taskbar Properties" onclick="fnStart(9)"><br> 
      <INPUT type="button" value="Open Favorites Folder" onclick="fnStart(8)"><br> 
      <INPUT type="button" value="Browse Program Files" onclick="fnStart(7)"><br> 
      <INPUT type="button" value="Explore My Documents" onclick="fnStart(6)"><br> 
      <INPUT type="button" value="Modify Internet Properties" onclick="fnStart(5)"><br> 
      <INPUT type="button" value="Set System Time" onclick="fnStart(4)"><br> 
      <INPUT type="button" value="Find a File or Folder" onclick="fnStart(3)"><br> 
      <INPUT type="button" value="Shut Down Windows" onclick="fnStart(2)"><br> 
      <INPUT type="button" value="Run" onclick="fnStart(1)">      
      <INPUT type="button" value="Minimize All Windows" onclick="fnStart(0)">


      • #4
        This thread seems to cover it: Equivalent of self.find() in IE
        hmm... ?


        • #5
          Yes it does! More so actually as it gives the replace functionality too! Not that I need it but whoa... lol

          Thanks a bunch swmr,


          • #6
            Thanks swmr

            Perhaps now I will finish that editor.



            • #7
              Just for the record, I managed to locate the actual Internet Explorer "Find" resource:

              This is fully-functional only when called from an HTA.

              Seems to work as expected...

              <title>Resource test: Find-Dialog</title>
              <HTA:APPLICATION />
              <script type="text/JScript">
              // global variables referenced from FIND.DLG 
              var unsecuredWindowOfDocument = window;
              var findText = ""; // can specify initial search term with this parameter
              function useFind(){
              // Shell object is only necessary if you don't know the path of shdoclc.dll, 
              // such as: "res://C:\\WINNT\\System32\\shdoclc.dll/FIND.DLG"
              var resource = "res://" + 
              new ActiveXObject("Shell.Application").NameSpace(37).parseName("shdoclc.dll").Path + 
              alert("Shell: " + e);
              return false;
              showModelessDialog(resource, window, "status:0");
              // can also link to "BIDIFIND.DLG", for unicode-bidirectional searches...
              <button onclick="useFind()">Find</button>
              Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
              sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
              Ut enim ad minim veniam, 
              quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
              Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore 
              eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, 
              sunt in culpa qui officia deserunt mollit anim id est laborum.
              Last edited by swmr; Mar 29, 2004, 05:07 PM.
              hmm... ?


              • #8

                Thanks again for sharing.

                But, FWIW I added that snippet to my editor and it works locally as .html but does not work on a server. (Shell object error)



                • #9
                  What's a server?
                  Last edited by swmr; Mar 29, 2004, 05:07 PM.
                  hmm... ?


                  • #10
                    Originally posted by swmr
                    What's a server?
                    My g/f, she objected to finding what I wanted.



                    • #11
                      BTW, "fully-functional" referred to the context-sensitive help feature working -- only in HTAs...
                      Last edited by swmr; Mar 29, 2004, 05:08 PM.
                      hmm... ?


                      • #12
                        Ok, one more thing (or two)...

                        I'd assumed that an absolute path was necessary, but being that the resource is in the Windows directory (i.e., the "search path"), this is all that's actually needed:

                        <script type="text/JScript">
                        var findText = "";
                        var unsecuredWindowOfDocument = window;
                        function useFind(){
                        showModelessDialog("res://shdoclc.dll/FIND.DLG", window, "status:0");
                        Though this is probably still limited to local files, as stated here:
                        res Protocol

                        Note Internet Explorer 6 Service Pack 1 (SP1) no longer allows browsing a local machine from the Internet zone. For instance, if an Internet site contains a link to a local file, Internet Explorer 6 SP1 displays a blank page when a user clicks on the link. Previous versions of Internet Explorer followed the link to the local file.
                        hmm... ?