Skip to content

The Righteous Cause

Whoever said the pen is mightier than the sword obviously never encountered Rambo’s fully automatic M60 belt fed Machine Gun.

Menu
  • Recent Posts
Menu

Grok: Can you write code for a Microsoft Edge browser extension?

Posted on March 24, 2025March 24, 2025 by Dennis Robbins

I can help you write code for a Microsoft Edge browser extension, leveraging the information from the web search results. Microsoft Edge extensions are built using web technologies like HTML, CSS, and JavaScript, and they follow the same structure as Chrome extensions since Edge is Chromium-based. Below, I’ll create a simple Microsoft Edge extension that displays a pop-up with a random quote when the user clicks the extension icon. I’ll walk through the necessary files, code, and steps to get it running, based on the tutorial structure in (docs.microsoft.com) and the general guidance in (learn.microsoft.com).


Microsoft Edge Extension: Random Quote Generator

This extension will:

  1. Display a pop-up with a random quote when the user clicks the extension icon.
  2. Use a simple HTML/CSS interface for the pop-up.
  3. Include a JavaScript file to fetch and display a random quote.
  4. Be compatible with Microsoft Edge, as it’s Chromium-based.

Step 1: Set Up the Directory Structure

Create a folder for your extension (e.g., random-quote-extension) with the following files:

  • manifest.json (defines the extension’s metadata and permissions)
  • popup.html (the pop-up UI)
  • popup.css (styles for the pop-up)
  • popup.js (logic to display a random quote)
  • icon.png (a 128×128 icon for the extension)

Step 2: Create the manifest.json File

The manifest.json file is the core configuration file for the extension. It defines the extension’s name, version, permissions, and the pop-up file to display.

{
“manifest_version”: 3,
“name”: “Random Quote Generator”,
“version”: “1.0”,
“description”: “Displays a random quote in a pop-up.”,
“action”: {
“default_popup”: “popup.html”,
“default_icon”: “icon.png”
},
“permissions”: [],
“icons”: {
“128”: “icon.png”
}
}
  • manifest_version: 3 is the latest version as of 2025, ensuring compatibility with modern Edge requirements.
  • action specifies the pop-up file (popup.html) to display when the icon is clicked.
  • No permissions are needed since this extension doesn’t access external APIs or user data.

Step 3: Create the popup.html File

This file defines the structure of the pop-up window.

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Random Quote</title>
<link rel=”stylesheet” href=”popup.css”>
</head>
<body>
<div class=”container”>
<h1>Random Quote</h1>
<p id=”quote”>Click the button to get a quote!</p>
<button id=”getQuoteBtn”>New Quote</button>
</div>
<script src=”popup.js”></script>
</body>
</html>
  • The pop-up includes a heading, a paragraph to display the quote, and a button to fetch a new quote.
  • It links to popup.css for styling and popup.js for functionality.

Step 4: Create the popup.css File

This file styles the pop-up to make it visually appealing.

body {
width: 300px;
font-family: Arial, sans-serif;
margin: 0;
padding: 10px;
background-color: #f0f0f0;
}

.container {
text-align: center;
}

h1 {
font-size: 18px;
color: #333;
margin-bottom: 10px;
}

p#quote {
font-style: italic;
color: #555;
margin: 10px 0;
min-height: 40px;
}

button {
background-color: #0078d4;
color: white;
border: none;
padding: 8px 16px;
cursor: pointer;
border-radius: 4px;
font-size: 14px;
}

button:hover {
background-color: #005ea2;
}

  • The styles ensure the pop-up is compact (300px wide, as typical for browser pop-ups) and user-friendly, with a clean design.

Step 5: Create the popup.js File

This file contains the JavaScript logic to display a random quote when the button is clicked.

document.addEventListener(‘DOMContentLoaded’, function() {
const quoteElement = document.getElementById(‘quote’);
const getQuoteBtn = document.getElementById(‘getQuoteBtn’);

// Array of sample quotes
const quotes = [
“The only way to do great work is to love what you do. – Steve Jobs”,
“Life is what happens when you’re busy making other plans. – John Lennon”,
“In the middle of difficulty lies opportunity. – Albert Einstein”,
“You miss 100% of the shots you don’t take. – Wayne Gretzky”,
“The best way to predict the future is to create it. – Peter Drucker”
];

// Function to get a random quote
function displayRandomQuote() {
const randomIndex = Math.floor(Math.random() * quotes.length);
quoteElement.textContent = quotes[randomIndex];
}

// Display a quote on button click
getQuoteBtn.addEventListener(‘click’, displayRandomQuote);

// Display a quote when the pop-up loads
displayRandomQuote();
});

  • The script waits for the DOM to load, then sets up a button event listener to display a random quote from an array.
  • A quote is also displayed immediately when the pop-up opens, enhancing user experience.

Step 6: Add an Icon

You’ll need a 128×128 PNG image named icon.png for the extension’s icon. You can create a simple image (e.g., a quote bubble) using any graphic design tool, or download a free icon from a site like Flaticon (ensure proper licensing). Place it in the extension folder.

Step 7: Load and Test the Extension in Microsoft Edge

  1. Open Microsoft Edge.
  2. Go to edge://extensions/.
  3. Enable “Developer mode” (toggle in the top-right corner).
  4. Click “Load unpacked” and select your random-quote-extension folder.
  5. The extension should appear in your toolbar. Click its icon to see the pop-up, and test the “New Quote” button.

Step 8: Publish the Extension (Optional)

If you want to publish this extension, you can submit it to the Microsoft Edge Add-ons website. You’ll need to:

  • Register a developer account with a Microsoft account.
  • Package your extension files into a ZIP file.
  • Submit it via the Edge Add-ons developer dashboard.

Conclusion

This simple Microsoft Edge extension demonstrates the basics of creating a pop-up, which builds an extension to display an image in a pop-up without JavaScript. Our version adds interactivity with JavaScript, showing how to enhance functionality while keeping the code minimal. The extension is fully compatible with Microsoft Edge since it’s Chromium-based, and it can be easily modified to include more features, like fetching quotes from an API (which would require adding permissions in the manifest). This code provides a solid starting point for anyone looking to develop their own Edge extension.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search Posts

News & Commentary

Somewhere in the world, there is a defeat for everyone. Some are destroyed by defeat, and some made small and mean by victory. Greatness lives in one who triumphs equally over defeat and victory.

~John Steinbeck

Email: dennis@novus2.com

Recent Posts

  • Is refurbishing Alcatraz a good idea? Grok says no.
    Refurbishing Alcatraz Federal Penitentiary to resume operations as a functioning prison capable of receiving inmates is a complex endeavor, given its historical status, deteriorating infrastructure, isolated island location, and modern regulatory requirements. Below, I […]
  • Rethinking Creative Collaboration: A Response to “Did AI Writing Count as Your Writing?”
    From Deseret.com: Perspective: If you depend on AI to write something, then have you actually written it? Honest question: if you need AI to generate ideas for stories, to rewrite your sentences and paragraphs, or restructure your book, or even produce any portion of a […]
  • Brazen Bill Brazelton: The Masked Highwayman of the Southwest
    The sun beat down mercilessly on the Arizona Territory in the summer of 1878, casting long shadows across the dusty trails that connected the scattered settlements of the Southwest. For travelers along these routes, the journey was arduous enough without the added fear of […]
  • The Growing Concerns and Impact of Artificial Intelligence on Human Behavior
    Artificial Intelligence (AI), particularly conversational models like ChatGPT, has transformed how we interact with technology, offering unprecedented access to information and personalized responses. However, as AI integrates deeper into daily life, it is beginning to […]
  • Protected: Zero Hour Protocol
    There is no excerpt because this is a protected post.
  • How to Navigate the Firehose of News Headlines: A Guide to Filtering Information Overload
    In an era where news headlines stream incessantly across our screens—on social media, news apps, and websites—the sheer volume of information can feel like drinking from a firehose. Every hour, we’re bombarded with breaking news, opinion pieces, and viral stories, each […]
  • Environmental Concerns and Impact of Recent Developments in Artificial Intelligence Introduction
    Artificial Intelligence (AI) has ushered in transformative advancements across industries, from healthcare to transportation, with recent developments like ChatGPT’s enhanced search capabilities and generative AI models pushing the boundaries of innovation. However, these […]
  • The Atlantic notes: “Something Alarming Is Happening to the Job Market”
    The Atlantic: A new sign that AI is competing with college grads Something strange, and potentially alarming, is happening to the job market for young, educated workers. According to the New York Federal Reserve, labor conditions for recent college graduates have […]
  • Pastor Joey Sampaga’s sermon notes: “Faithful Eyes: Recognizing the Messiah,” based on Luke 2:21-38.
    East Valley International Church is where faith meets innovation! With xAI’s Grok jotting down notes, Pastor Joey Sampaga’s sermon on “Recognizing the Messiah” (Luke 2:21-38) comes alive. His heartfelt teaching ties Scripture to our daily lives, inspiring our lively […]
  • E.V.I.C. Sunday School Notes: What is Salvation?
    East Valley International Church merges faith with technology, using xAI’s Grok to capture Sunday School insights. Pastor Joey Sampaga’s exploration of “What is Salvation,” delving into biblical teachings, theological depth, and its relevance for today’s believers, brings […]
  • Unlocking Phoenix’s Job Market: The Ultimate List
    Your Ultimate Guide to Direct Career Pages for Top Corporations, Medical Facilities, Tech Startups, and More in the Valley of the Sun Welcome to the definitive resource for job seekers in the Phoenix, Arizona, metropolitan area—spanning Phoenix, Mesa, Tempe, Glendale, […]
  • Is Scientology a True Religion for the Twenty-First Century or Just Another Space Opera Cult?
    THE MOVIE: Battlefield Earth To put it bluntly, Battlefield Earth stands out as a colossal failure in the sci-fi genre, “much like the Hindenburg disaster did for Zeppelin air travel.” While not explicitly a Scientology film, Battlefield Earth, based on L. Ron […]
  • Zero Hour Protocol — End Notes
    Zero Hour Protocol — End Notes Dear Reader, You’ve just experienced “Zero Hour Protocol,” a collaborative work between human creativity and artificial intelligence. As the author behind this project, I wanted to share a glimpse into the unique […]
  • Nailed to the Cross: A Biblical and Historical Investigation into Jesus’s Crucifixion
    A recent article from *Christianity Today* (https://www.christianitytoday.com/2025/04/was-jesus-crucified-with-nails/) raises the provocative claim that Jesus was crucified using ropes rather than nails, challenging centuries of Christian tradition and biblical testimony. […]
  • Debunking Everytown’s Dubious Claim: No Evidence for “1 in 15 Adults” Experiencing Mass Shootings
    Everytown Research & Policy, a prominent gun control advocacy group, recently posted a graphic on X claiming that “1 in 15 adults in the U.S. have experienced a mass shooting.” This staggering statistic, implying over 17 million American adults have faced such trauma, […]
©2025 The Righteous Cause | Built using WordPress and Responsive Blogily theme by Superb