e dot dot dot
a mostly about the Internet blog by

home << Programming << Javascript
May 2025
Sun Mon Tue Wed Thu Fri Sat
       


Universal JS Download Modal Triggering Code

This handy javascript programming takes two incoming arguments, and invokes the download dialogue modal for any text supplied to it. Just provide it with a fileName (to be used when saving the "file"), and fileContents, and see for yourself.

Highlight and copy the Javascript code below, starting with the "function" line, and ending with the very last right-squiggly-bracket that's followed by a semi-colon.

#########################################################
JS Programming Below
#########################################################
function createAndDownloadFile(fileName, fileContent) {

// Create a Blob from the content (assuming it's text data)
const blob = new Blob([fileContent], { type: 'text/plain' });

// Create an object URL for the Blob
const url = URL.createObjectURL(blob);

// Create an anchor element
const a = document.createElement('a');

// Set the download attribute with the specified file name
a.download = fileName;

// Set the href attribute to the Blob URL
a.href = url;

// Append the anchor element to the document body (required for Firefox)
document.body.appendChild(a);

// Trigger a click on the anchor element to start the download
a.click();

// Clean up by removing the anchor element
document.body.removeChild(a);

// Optionally, release the object URL after use to free memory
URL.revokeObjectURL(url);
};
#########################################################
JS Programming Above
#########################################################


posted at: 9:54am on 09-Apr-2025
path: /Programming/Javascript | permalink | edit (requires password)

0 comments, click here to add the first



Spoof Check

Here's a simple but effective tool in the fight against phishing and ultimately, identity theft.

Save this as a toolbar bookmark (a bookmarklet), and use it to check if you've visited a "spoofed" site or not.

tip: left-click and drag this site's url icon to your toolbar, then right-click it to edit its properties, and change the "location" to contain the code below, and the "name" to Spoof Check.


javascript:alert("The actual URL is:\t\t" + location.protocol + "//" + location.hostname + "/" + "\nThe address URL is:\t\t" + location.href + "\n" + "\nIf the server names do not match, this may be a spoof.");



posted at: 1:23am on 06-Dec-2006
path: /Programming/Javascript | permalink | edit (requires password)

0 comments, click here to add the first



Libraries Make A Coder's Life Easier

And I'm not talking about the kinds with old fashioned card catalogs and ornery ladies with blue hair and reading spectacles around their necks.

The libraries of which I speak are of the Javascript codebase variety that allow sophisticated user interfaces to be incorporated into web pages by even the most casual of coders and webmasters.

Here's a good free one, called Dojo. As their website says,"Dojo lets you prototype interactive widgets quickly, animate transitions, and build Ajax requests with the most powerful and easiest to use abstractions available."

There are many out there.

So stop reinventing the wheel, and get going instead on offering that revolutionary new service of yours.


posted at: 5:41pm on 16-Feb-2006
path: /Programming/Javascript | permalink | edit (requires password)

0 comments, click here to add the first



Quick Amazon Direct URL Generator

I was tired of schlepping (spelling?) over to Amazon to re-familiarize myself with how to set up a direct url to a single product, so I created this little bookmarklet:

Create Amazon Url

It works as is, by clicking on it, or just left-click on it and drag it up to your browser's toolbar and it will be saved there for whenever you need it.

Once it's on the tool bar, right-click on its icon and left-click on the Properties menu selection.

When that comes up, you just have to change where it says "YourAmazonAffiliateIDHere", to be your actual Amazon affiliate id.

Happy Holidays!


posted at: 9:23am on 18-Dec-2005
path: /Programming/Javascript | permalink | edit (requires password)

0 comments, click here to add the first


home << Programming << Javascript

May 2025
Sun Mon Tue Wed Thu Fri Sat
       







RSS (site)  RSS (path)

ATOM (site)  ATOM (path)

Categories
 - blog home

 - Announcements  (0)
 - Annoyances  (0)
 - Career_Advice  (0)
 - Domains  (0)
 - Downloads  (3)
 - Ecommerce  (0)
 - Fitness  (0)
 - Home_and_Garden  (0)
     - Cooking  (0)
     - Tools  (0)
 - Humor  (0)
 - Notices  (0)
 - Observations  (1)
 - Oddities  (2)
 - Online_Marketing  (0)
     - Affiliates  (1)
     - Merchants  (1)
 - Programming  (0)
     - Bookmarklets  (1)
     - Browsers  (1)
     - DHTML  (0)
     - Javascript  (4)
     - PHP  (0)
     - PayPal  (1)
     - Perl  (37)
          - blosxom  (0)
     - Unidata_Universe  (22)
 - Random_Advice  (1)
 - Reading  (0)
     - Books  (0)
     - Ebooks  (0)
     - Magazines  (0)
     - Online_Articles  (3)
 - Resume_or_CV  (1)
 - Reviews  (2)
 - Rhode_Island_USA  (0)
     - Providence  (1)
 - Shop  (0)
 - Sports  (0)
     - Football  (0)
          - Cowboys  (0)
          - Patriots  (0)
     - Futbol  (0)
          - The_Rest  (0)
          - USA  (0)
 - Technology  (3197)
 - Windows  (1)
 - Woodworking  (0)


Archives
 -2025  May  (73)
 -2025  April  (149)
 -2025  March  (164)
 -2025  February  (151)
 -2025  January  (167)
 -2024  December  (155)
 -2024  November  (156)
 -2024  October  (158)
 -2024  September  (155)
 -2024  August  (162)
 -2024  July  (167)
 -2024  June  (161)
 -2024  May  (153)
 -2024  April  (160)


My Sites

 - Millennium3Publishing.com

 - SponsorWorks.net

 - ListBug.com

 - TextEx.net

 - FindAdsHere.com

 - VisitLater.com