Skip navigation

JSI Tip 5325. Internet Explorer extension to copy Web page title and URL to the clipboard.

If you would like to be able to right-click in a Web page and press Copy Title and URL to send the page title and URL to the clipboard, Copy / Paste the script on this page to a TITLE_URL.BAT file, and double-click it.

TITLE_URL.BAT creates an Internet Explorer extension by creating a %Windir%\Web\Title_URL.HTM file and adds some registry values at HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Copy Title and &URL. To uninstall the extension, delete the key and file.

NOTES: Internet Explorer 4.0 or greater is required.

The original code for this tip came from [email protected]. It was hard-coded for C:\Windows, and had a few minor problems. I encapsulated it as a self-installing script to simplify implementation.

TITLE_URL.BAT contains:

@echo off
@echo ^<form name=a^>^<textarea^ name=a1^>^</textarea^> >%windir%\Web\TITLE_URL.HTM
@echo ^<SCRIPT language=javascript defer^> >>%windir%\Web\TITLE_URL.HTM
@echo //To enable popup confirmation, change "showConfirm=0" to "showConfirm=1" >>%windir%\Web\TITLE_URL.HTM
@echo var showConfirm=^0>>%windir%\Web\TITLE_URL.HTM
@echo var oExtArgs=external.menuArguments;>>%windir%\Web\TITLE_URL.HTM
@echo var sTitle=oExtArgs.document.title;>>%windir%\Web\TITLE_URL.HTM
@echo if(sTitle==')(sTitle='No Title');>>%windir%\Web\TITLE_URL.HTM
@echo var oTarget=document.a.a1;>>%windir%\Web\TITLE_URL.HTM
@echo oTarget.value=sTitle+': \r\n'+oExtArgs.location.href+'\r\n';>>%windir%\Web\TITLE_URL.HTM
@echo oTarget.select();>>%windir%\Web\TITLE_URL.HTM
@echo var oTextRange=oTarget.createTextRange();>>%windir%\Web\TITLE_URL.HTM
@echo oTextRange.execCommand('copy');>>%windir%\Web\TITLE_URL.HTM
@echo if(showConfirm)(oExtArgs.alert(oTarget.value+'\r\nCopied to Clipboard'));>>%windir%\Web\TITLE_URL.HTM
@echo ^</SCRIPT^>>>%windir%\Web\TITLE_URL.HTM
@echo REGEDIT4>"%temp%\Title_URL.reg"
@echo \[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Copy Title and ^&URL\]>>"%temp%\Title_URL.reg"
set foldpath=@="%windir%\web\TITLE_URL.HTM"
set foldpath=%foldpath:\=\\%
@echo %foldpath%>>"%temp%\Title_URL.reg"
@echo "contexts"=dword:00000001>>"%temp%\Title_URL.reg"
regedit /s "%temp%\Title_URL.reg"


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish