Wednesday 20 February 2013

Simple Bookmarklet to get webpage link and title

 If are posting an article and if you want to "link" any any webpage or website from your blog or website then you need manually create a html anchor tag and you will need plugin:-
  • Webpage url
  • Webpage title
 To simplify things I have written some bookmarklets which you can easily create in your browsers bookmarks toolbar. You can plugin the below codes in location / url textbox when creating a bookmark or favourites. In Firefox, SeaMonkey and Opera "ctrl+D" is the shortcut to create bookmarks. After creating the bookmarklet all you need to do is navigate to the relevant webpage and then click on the bookmarlet to get the anchor tag in a popup / alert window.
  • Get Link with title for webpage.
    javascript:window.alert("<a%20href=\""+document.location.href+"\">"+document.title+"</a>");
  • Get Link with title and a nofollow tag for a webpage. javascript:window.alert("<a%20rel=\"nofollow\"%20href=\""+document.location.href+"\">"+document.title+"</a>"); 
  • Get Link with title no follow and open in new tab or window for a webpage.
    javascript:window.alert("<a%20rel=\"nofollow\"%20target=\"_blank\"%20href=\""+document.location.href+"\">"+document.title+"</a>");  

 The below screenshot shows as to how to create the bookmarklet in SeaMonkey / Firefox after pressing Ctrl+D .
SeaMonkey create bookmarklet bookmarks toolbar
After creation of bookmarlet click on it to get webpage link
Click bookmarklet get webpage link

No comments:

Post a Comment