Jump to content

[Request] Validate current webpage for CSS and HTML


Recommended Posts

My primary browser is Firefox and I currently use "Web Developer" add-on to validate CSS or HTML of the current webpage.

 

yxUiqtk.png

 

Sample URL structure:

 

Validate CSS:

http://jigsaw.w3.org/css-validator/validator?profile=css21&warning=0&uri=http%3A%2F%2Fwww.google.co.in%2F

Validate HTML:

http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.google.co.in%2F

It would be very handy to just bring up Alfred and start typing 'v a l i d a t e' and be presented with two opitons: 1) CSS 2) HTML and then the selecting an option would send the current webpage URL to corresponding validator site.

 

Thanks in advance.

Edited by Sridhar Katakam
Link to comment

My primary browser is Firefox and I currently use "Web Developer" add-on to validate CSS or HTML of the current webpage.

 

yxUiqtk.png

 

Sample URL structure:

 

Validate CSS:

http://jigsaw.w3.org/css-validator/validator?profile=css21&warning=0&uri=http%3A%2F%2Fwww.google.co.in%2F

Validate HTML:

http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.google.co.in%2F

It would be very handy to just bring up Alfred and start typing 'v a l i d a t e' and be presented with two opitons: 1) CSS 2) HTML and then the selecting an option would send the current webpage URL to corresponding validator site.

 

Thanks in advance.

 

Firefox's AppleScript support is poor. I don't know that it's possible to easily grab the current URL via AppleScript and so to achieve this, you may have to provide the URL yourself. That being said, the rest could be rather simple. You could create a script filter that has two options, to validate the html and to validate the css where the argument for the two items would simply be the URL to the W3 Validator. You could then press Enter to open that page or press Shift (or Cmd+Y) to QuickLook them and not have to open a browser.

cat << EOF
<items>
  <item uid="valHTML" arg="http://validator.w3.org/check?verbose=1&uri={query}">
    <title>Validate HTML</title>
    <subtitle>Validate athttp://validator.w3.org/check</subtitle>
    <icon>icon.png</icon>
  </item>
  <item uid="valCSS" arg="http://jigsaw.w3.org/css-validator/validator?profile=css21&warning=0&uri={query}">
    <title>Validate CSS</title>
    <subtitle>Validate at http://jigsaw.w3.org/css-validator/validator</subtitle>
    <icon>icon.png</icon>
  </item>
</items>
EOF

If you wanted to open the page, you would simply add an Open URL item behind the Script Filter and connect the two.

Link to comment

I created a workflow based on the above info but I must be missing something as it's not working.

 

This is how I have it:

 

bCTlYR4.png

 

fSbgUG7.png

5whHqtt.png

 

When I provide a URL to validate and hit Return, nothing happens.

 

fdGETSR.png

 

workflow: http://cl.ly/0T0R141k2v1g

 

It looks like you're missing the '{query}' parameter in the 'Open URL' object. Instead of leaving that text box blank, put '{query}' inside of it.

 

Cheers :)

Link to comment

Thanks Tyler. That fixed it.

 

Thanks for helping Tyler.

 

Sridhar, is this what you were looking for? As mentioned, don't forget that, highlighting one of the options and pressing Shift should bring up Quicklook and show the results. That way you don't actually have to open a browser to see the results.

Link to comment

Ideally I don't need to provide a URL and whatever page is currently active and open in Firefox should be used. But this will do for now and I noted the fact where you said Firefox does not have good support for scripting.

 

I have set up a single key shortcut, u to copy page URL to clipboard using KeyConfig, so it's not much work anyway to get the URL ready to be used in the workflow.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...