SlideShare a Scribd company logo
Chrome Extensions
Make an HTML Validator
What’s the problem?
I’m grading html pages and they need to be valid HTML
I want to automate copying the URL and testing it in the https://validator.w3.org/
Step 1: Create a directory
Create a new directory to hold the extension code and open in IDE
cd projects/chrome-ext
mkdir ext-html-validate
Step 2: Create a manifest.json file
The manifest lists properties of and resources used by the extension.
touch ext-html-validate/manifest.json
Step 3: Add information to manifest.json
Open an IDE and modify the manifest.json that should be in the root of the
directory you created.
https://developer.chrome.com/apps/manifest
{
"manifest_version": 2,
"name": "HTML Validator",
"description": "Validate HTML on a page",
"version": "1.0",
"browser_action": {
"default_icon": {
"32": "images/valid128.png"
},
"default_popup": "popup.html"
},
"permissions": ["activeTab"]
}
Step 4: Create a 128px icon
Find or create a icon. You might also want to add your own 16px and 48px icons
or chrome will just modify your 128px icon.
● You can use paint (windows) or preview (Mac)
● Create an images directory in your IDE
● Copy the valid.png 128px X 128px icon into the directory
● -or- get an image from the web
Put in the folder referred to in the manifest.
https://github.com/rebeccapeltz/html-validate-ext/blob/master/images/valid128.png
Step 5: Deploy extension to Chrome
Go to chrome://extensions in your browser
Ensure that the Developer mode checkbox in the top right-hand corner is checked
Click Load unpacked extension to pop up a file-selection dialog & select your
directory.
See the icon - click on it and no file found
Step 6: Create popup.html
<!doctype html>
<html>
<head>
<title>HTML Validator</title>
<script src="popup.js"></script>
</head>
<body>
<h1>HTML Validator</h1>
<button id="validatePage">Validate this page now!</button>
</body>
</html>
Step 7: add popup.js
document.addEventListener('DOMContentLoaded', function() {
let validateButton = document.getElementById('validatePage');
validateButton.addEventListener('click', function() {
//use the chrome tabs API
chrome.tabs.getSelected(null, function(tab) {
//get the current tab's URL
let encodedUrl = encodeURIComponent(tab.url)
//create a call to w3 validator with current url
let validateUrl =
`https://validator.w3.org/nu/?showsource=yes&doc=${encodedUrl}`;
//create a new tab with this URL
chrome.tabs.create({ url: validateUrl });
});
});
});
Let’s try it out
Step 8: How to debug
You can inspect the popup.html
If you need to reload the page from within the popup inspect, go to the console
and type
location.reload()
How to Host
Package the app
What you need to publish: https://developer.chrome.com/webstore/publish
Go to Dashboard: create a new google account if you don’t want to get pinged on
this ( peltzrc)
https://chrome.google.com/webstore/developer/dashboard?pli=1&authuser=1
Well defined icon specs: https://developer.chrome.com/extensions/manifest/icons
Package
● A detailed description of your application. Write your description to entice
users to download your app.
● A 128x128 icon to display in the store. You may re-use your app icon here.
● At least one 1280x800 or 640x400 screenshot or YouTube video to show off
what your app does. https://youtu.be/XNG9dxsTICU
● A 440x280 small tile icon that will be displayed on the Chrome Web Store
wall. https://github.com/rebeccapeltz/html-validate-ext/blob/master/images/chrome-web-store-
wall.png
● The primary category where your app should be listed.
● Your app's language to help users find it.
● ZIP up the folder holding your extension code
Validate HTML with One Click
No more cutting and pasting links
Add new item on dashboard
Add new item
Enter information on extension
Ad

Recommended

PDF
Devoxx 2014-webComponents
Cyril Balit
 
PPTX
A test framework out of the box - Geb for Web and mobile
GlobalLogic Ukraine
 
PDF
HTML5 - The 2012 of the Web
Robert Nyman
 
PPTX
Geb qa fest2017
Sviatkin Yaroslav
 
PDF
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
Alkacon Software GmbH & Co. KG
 
PDF
HTML5 - The 2012 of the Web - Adobe MAX
Robert Nyman
 
PDF
A comprehensive guide on developing responsive and common react filter component
Katy Slemon
 
KEY
Facebook api
Sangon Lee
 
PPTX
jQuery Mobile
mowd8574
 
PPTX
CHATBOT using Facebook Messenger
Navjyotsinh Jadeja
 
PDF
JavaScript
tutorialsruby
 
PPTX
Pinned Sites IE 9 Lightup
Wes Yanaga
 
DOCX
Testing.g mail&gdrive.multi login.fix
admin15kkr
 
KEY
Eu odeio OpenSocial
Carlos Brando
 
PPTX
Jquery mobile
Eric Turcotte
 
DOCX
CRUD VB2010
Achmad Sidik
 
PPTX
How to create a jQuery Modal Window
Likno Software
 
PDF
Introduction to jQuery
Nagaraju Sangam
 
PDF
Master AngularJS
Fabien Vauchelles
 
PDF
JavaScript - Chapter 11 - Events
WebStackAcademy
 
PPTX
FuncUnit
Brian Moschel
 
PPTX
Client Web
Markiyan Matsekh
 
PDF
Vue.js for beginners
Julio Bitencourt
 
PPT
Android Button
bhavin joshi
 
PPTX
jQuery Mobile UI
LearningTech
 
PDF
InheritedWidget is your friend - GDG London (2018-08-08)
Andrea Bizzotto
 
PPT
javascript examples
Egerton University
 
PDF
Joomla v-15-squeezebox-in-your-joomla-website
RBaggio2000
 
PPTX
Hosting video js friends (2)
Rebecca Peltz
 
PPTX
Gitbook FAQs
Rebecca Peltz
 

More Related Content

What's hot (20)

PPTX
jQuery Mobile
mowd8574
 
PPTX
CHATBOT using Facebook Messenger
Navjyotsinh Jadeja
 
PDF
JavaScript
tutorialsruby
 
PPTX
Pinned Sites IE 9 Lightup
Wes Yanaga
 
DOCX
Testing.g mail&gdrive.multi login.fix
admin15kkr
 
KEY
Eu odeio OpenSocial
Carlos Brando
 
PPTX
Jquery mobile
Eric Turcotte
 
DOCX
CRUD VB2010
Achmad Sidik
 
PPTX
How to create a jQuery Modal Window
Likno Software
 
PDF
Introduction to jQuery
Nagaraju Sangam
 
PDF
Master AngularJS
Fabien Vauchelles
 
PDF
JavaScript - Chapter 11 - Events
WebStackAcademy
 
PPTX
FuncUnit
Brian Moschel
 
PPTX
Client Web
Markiyan Matsekh
 
PDF
Vue.js for beginners
Julio Bitencourt
 
PPT
Android Button
bhavin joshi
 
PPTX
jQuery Mobile UI
LearningTech
 
PDF
InheritedWidget is your friend - GDG London (2018-08-08)
Andrea Bizzotto
 
PPT
javascript examples
Egerton University
 
PDF
Joomla v-15-squeezebox-in-your-joomla-website
RBaggio2000
 
jQuery Mobile
mowd8574
 
CHATBOT using Facebook Messenger
Navjyotsinh Jadeja
 
JavaScript
tutorialsruby
 
Pinned Sites IE 9 Lightup
Wes Yanaga
 
Testing.g mail&gdrive.multi login.fix
admin15kkr
 
Eu odeio OpenSocial
Carlos Brando
 
Jquery mobile
Eric Turcotte
 
CRUD VB2010
Achmad Sidik
 
How to create a jQuery Modal Window
Likno Software
 
Introduction to jQuery
Nagaraju Sangam
 
Master AngularJS
Fabien Vauchelles
 
JavaScript - Chapter 11 - Events
WebStackAcademy
 
FuncUnit
Brian Moschel
 
Client Web
Markiyan Matsekh
 
Vue.js for beginners
Julio Bitencourt
 
Android Button
bhavin joshi
 
jQuery Mobile UI
LearningTech
 
InheritedWidget is your friend - GDG London (2018-08-08)
Andrea Bizzotto
 
javascript examples
Egerton University
 
Joomla v-15-squeezebox-in-your-joomla-website
RBaggio2000
 

More from Rebecca Peltz (7)

PPTX
Hosting video js friends (2)
Rebecca Peltz
 
PPTX
Gitbook FAQs
Rebecca Peltz
 
PPTX
Gitbook Publish FAQ
Rebecca Peltz
 
PPTX
Meetup gitbook
Rebecca Peltz
 
PPTX
Intro chrome extensions
Rebecca Peltz
 
PPTX
Make an language translator with voice extension
Rebecca Peltz
 
ODP
Ado Presentation
Rebecca Peltz
 
Hosting video js friends (2)
Rebecca Peltz
 
Gitbook FAQs
Rebecca Peltz
 
Gitbook Publish FAQ
Rebecca Peltz
 
Meetup gitbook
Rebecca Peltz
 
Intro chrome extensions
Rebecca Peltz
 
Make an language translator with voice extension
Rebecca Peltz
 
Ado Presentation
Rebecca Peltz
 
Ad

Recently uploaded (20)

PDF
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
 
PDF
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
PDF
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
PDF
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
Shane Coughlan
 
PDF
Best Software Development at Best Prices
softechies7
 
PDF
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
 
PDF
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
PPTX
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
PDF
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
DOCX
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
PPTX
Top Time Tracking Solutions for Accountants
oliviareed320
 
PDF
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
PPTX
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
PPTX
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
PPTX
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
PDF
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
PPTX
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
 
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
 
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
Shane Coughlan
 
Best Software Development at Best Prices
softechies7
 
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
 
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Simplify Insurance Regulations with Compliance Management Software
Insurance Tech Services
 
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Top Time Tracking Solutions for Accountants
oliviareed320
 
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
 
Ad

Make an html validator extension

  • 1. Chrome Extensions Make an HTML Validator
  • 2. What’s the problem? I’m grading html pages and they need to be valid HTML I want to automate copying the URL and testing it in the https://validator.w3.org/
  • 3. Step 1: Create a directory Create a new directory to hold the extension code and open in IDE cd projects/chrome-ext mkdir ext-html-validate
  • 4. Step 2: Create a manifest.json file The manifest lists properties of and resources used by the extension. touch ext-html-validate/manifest.json
  • 5. Step 3: Add information to manifest.json Open an IDE and modify the manifest.json that should be in the root of the directory you created. https://developer.chrome.com/apps/manifest
  • 6. { "manifest_version": 2, "name": "HTML Validator", "description": "Validate HTML on a page", "version": "1.0", "browser_action": { "default_icon": { "32": "images/valid128.png" }, "default_popup": "popup.html" }, "permissions": ["activeTab"] }
  • 7. Step 4: Create a 128px icon Find or create a icon. You might also want to add your own 16px and 48px icons or chrome will just modify your 128px icon. ● You can use paint (windows) or preview (Mac) ● Create an images directory in your IDE ● Copy the valid.png 128px X 128px icon into the directory ● -or- get an image from the web Put in the folder referred to in the manifest. https://github.com/rebeccapeltz/html-validate-ext/blob/master/images/valid128.png
  • 8. Step 5: Deploy extension to Chrome Go to chrome://extensions in your browser Ensure that the Developer mode checkbox in the top right-hand corner is checked Click Load unpacked extension to pop up a file-selection dialog & select your directory. See the icon - click on it and no file found
  • 9. Step 6: Create popup.html <!doctype html> <html> <head> <title>HTML Validator</title> <script src="popup.js"></script> </head> <body> <h1>HTML Validator</h1> <button id="validatePage">Validate this page now!</button> </body> </html>
  • 10. Step 7: add popup.js document.addEventListener('DOMContentLoaded', function() { let validateButton = document.getElementById('validatePage'); validateButton.addEventListener('click', function() { //use the chrome tabs API chrome.tabs.getSelected(null, function(tab) { //get the current tab's URL let encodedUrl = encodeURIComponent(tab.url) //create a call to w3 validator with current url let validateUrl = `https://validator.w3.org/nu/?showsource=yes&doc=${encodedUrl}`; //create a new tab with this URL chrome.tabs.create({ url: validateUrl }); }); }); });
  • 12. Step 8: How to debug You can inspect the popup.html If you need to reload the page from within the popup inspect, go to the console and type location.reload()
  • 13. How to Host Package the app What you need to publish: https://developer.chrome.com/webstore/publish Go to Dashboard: create a new google account if you don’t want to get pinged on this ( peltzrc) https://chrome.google.com/webstore/developer/dashboard?pli=1&authuser=1 Well defined icon specs: https://developer.chrome.com/extensions/manifest/icons
  • 14. Package ● A detailed description of your application. Write your description to entice users to download your app. ● A 128x128 icon to display in the store. You may re-use your app icon here. ● At least one 1280x800 or 640x400 screenshot or YouTube video to show off what your app does. https://youtu.be/XNG9dxsTICU ● A 440x280 small tile icon that will be displayed on the Chrome Web Store wall. https://github.com/rebeccapeltz/html-validate-ext/blob/master/images/chrome-web-store- wall.png ● The primary category where your app should be listed. ● Your app's language to help users find it. ● ZIP up the folder holding your extension code
  • 15. Validate HTML with One Click No more cutting and pasting links
  • 16. Add new item on dashboard
  • 18. Enter information on extension

Editor's Notes

  • #7: Browser action: default icon, default popup: show a button in the extension area and when you click shows the default popup Permissions: activeTab: allows application to look at code in active tab when you click on ext button while on the tab - no permission warning during ext load
  • #11: Create a listener for loading the popup page. Assign a listener to the validate button. When you click the validate use a chrome ext API that lets you get a handle on the current tab. URL encode the tab and then append to the w3 validator and set show source to “Yes”. Now open a new tab with the tabs.create API and load the URL string you created.