June 24, 2019

Dynamic Bookmarklets

Did you know that you can create dynamic bookmarks using Bookmarklets?

Dynamic makes it easy when you want to go right to a site using a predefined date. This is done by using a JavaScript date function and passing the results to the browser. You're not limited to just date functions, you could use any type of JavaScript condition to build the URL.

Some "Real World" Examples:

Atlassian Jira - Show me all the new issues created in the past 7 days. (This could easily be set up as a Dashboard widget - but that's a post for another day.)

Atlassian Jira - Show me all issues that have this week tag, where the tag format tag might look like: deployment-2019-01-07

Google Photos - Show me all photos taken on this day of the year or you can get fancy and say "Show me all photos taken 90-days ago."

Change the URL Server - you can check to see what day it is and change the URL to point to production on release day.

Bookmarklets Code

Sample Code

Here's a sample code


javascript:function url() {
 var date = new Date();
 var y = date.getFullYear(); 
 var m = date.getMonth() +1; 
 if(m < 10){m = '0' + m;}
 var d = date.getDate();
 if(d < 10){d = '0' + d;}
 var date = y + "-" + m + "-" + d;

 return 'https://www.company.com/analytics/web/?date'+ date +'/';

} window.open(url(),"_blank");

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!