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

More Related Content

What's hot

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

What's hot (20)

jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
CHATBOT using Facebook Messenger
CHATBOT using Facebook MessengerCHATBOT using Facebook Messenger
CHATBOT using Facebook Messenger
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 Lightup
 
Testing.g mail&gdrive.multi login.fix
Testing.g mail&gdrive.multi login.fixTesting.g mail&gdrive.multi login.fix
Testing.g mail&gdrive.multi login.fix
 
Eu odeio OpenSocial
Eu odeio OpenSocialEu odeio OpenSocial
Eu odeio OpenSocial
 
Jquery mobile
Jquery mobileJquery mobile
Jquery mobile
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
How to create a jQuery Modal Window
How to create a jQuery Modal WindowHow to create a jQuery Modal Window
How to create a jQuery Modal Window
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Master AngularJS
Master AngularJSMaster AngularJS
Master AngularJS
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
FuncUnit
FuncUnitFuncUnit
FuncUnit
 
Client Web
Client WebClient Web
Client Web
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
Android Button
Android ButtonAndroid Button
Android Button
 
jQuery Mobile UI
jQuery Mobile UIjQuery Mobile UI
jQuery Mobile UI
 
InheritedWidget is your friend - GDG London (2018-08-08)
InheritedWidget is your friend - GDG London (2018-08-08)InheritedWidget is your friend - GDG London (2018-08-08)
InheritedWidget is your friend - GDG London (2018-08-08)
 
javascript examples
javascript examplesjavascript examples
javascript examples
 
Joomla v-15-squeezebox-in-your-joomla-website
Joomla v-15-squeezebox-in-your-joomla-websiteJoomla v-15-squeezebox-in-your-joomla-website
Joomla v-15-squeezebox-in-your-joomla-website
 

Similar to Make an html validator extension

Web topic 22 validation on web forms
Web topic 22  validation on web formsWeb topic 22  validation on web forms
Web topic 22 validation on web forms
CK Yang
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
Lilia Sfaxi
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
pavishkumarsingh
 
Tutorial asp.net
Tutorial  asp.netTutorial  asp.net
Tutorial asp.net
Vivek K. Singh
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
Jermaine Oppong
 
jQuery
jQueryjQuery
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
Timothy Fisher
 
Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09
mihaiionescu
 
Aspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_csAspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_cs
Murali G
 
Java script Advance
Java script   AdvanceJava script   Advance
Java script Advance
Jaya Kumari
 
Option #1- Form Validation in JavaScript 1- In your text editor- open.docx
Option #1- Form Validation in JavaScript 1- In your text editor- open.docxOption #1- Form Validation in JavaScript 1- In your text editor- open.docx
Option #1- Form Validation in JavaScript 1- In your text editor- open.docx
farrahkur54
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
tutorialsruby
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
tutorialsruby
 
Chrome Extension
Chrome ExtensionChrome Extension
Chrome Extension
Andrei McMillan
 
Google external login setup in ASP (1).pdf
Google external login setup in ASP  (1).pdfGoogle external login setup in ASP  (1).pdf
Google external login setup in ASP (1).pdf
findandsolve .com
 
Jquery
JqueryJquery
計算機概論20161212
計算機概論20161212計算機概論20161212
計算機概論20161212
志宇 許
 
lect4
lect4lect4
lect4
lect4lect4
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
IMC Institute
 

Similar to Make an html validator extension (20)

Web topic 22 validation on web forms
Web topic 22  validation on web formsWeb topic 22  validation on web forms
Web topic 22 validation on web forms
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
Tutorial asp.net
Tutorial  asp.netTutorial  asp.net
Tutorial asp.net
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
 
jQuery
jQueryjQuery
jQuery
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09
 
Aspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_csAspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_cs
 
Java script Advance
Java script   AdvanceJava script   Advance
Java script Advance
 
Option #1- Form Validation in JavaScript 1- In your text editor- open.docx
Option #1- Form Validation in JavaScript 1- In your text editor- open.docxOption #1- Form Validation in JavaScript 1- In your text editor- open.docx
Option #1- Form Validation in JavaScript 1- In your text editor- open.docx
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 
Chrome Extension
Chrome ExtensionChrome Extension
Chrome Extension
 
Google external login setup in ASP (1).pdf
Google external login setup in ASP  (1).pdfGoogle external login setup in ASP  (1).pdf
Google external login setup in ASP (1).pdf
 
Jquery
JqueryJquery
Jquery
 
計算機概論20161212
計算機概論20161212計算機概論20161212
計算機概論20161212
 
lect4
lect4lect4
lect4
 
lect4
lect4lect4
lect4
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 

More from Rebecca Peltz

Hosting video js friends (2)
Hosting video js friends (2)Hosting video js friends (2)
Hosting video js friends (2)
Rebecca Peltz
 
Gitbook FAQs
Gitbook FAQsGitbook FAQs
Gitbook FAQs
Rebecca Peltz
 
Gitbook Publish FAQ
Gitbook Publish FAQGitbook Publish FAQ
Gitbook Publish FAQ
Rebecca Peltz
 
Meetup gitbook
Meetup gitbookMeetup gitbook
Meetup gitbook
Rebecca Peltz
 
Intro chrome extensions
Intro chrome extensionsIntro chrome extensions
Intro chrome extensions
Rebecca Peltz
 
Make an language translator with voice extension
Make an language translator with voice extensionMake an language translator with voice extension
Make an language translator with voice extension
Rebecca Peltz
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
Rebecca Peltz
 

More from Rebecca Peltz (7)

Hosting video js friends (2)
Hosting video js friends (2)Hosting video js friends (2)
Hosting video js friends (2)
 
Gitbook FAQs
Gitbook FAQsGitbook FAQs
Gitbook FAQs
 
Gitbook Publish FAQ
Gitbook Publish FAQGitbook Publish FAQ
Gitbook Publish FAQ
 
Meetup gitbook
Meetup gitbookMeetup gitbook
Meetup gitbook
 
Intro chrome extensions
Intro chrome extensionsIntro chrome extensions
Intro chrome extensions
 
Make an language translator with voice extension
Make an language translator with voice extensionMake an language translator with voice extension
Make an language translator with voice extension
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
 

Recently uploaded

Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 

Recently uploaded (20)

Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 

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

  1. 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
  2. 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.