How to check HTML / CSS in localhost?

I have local web pages that work dynamically on the local host that need to be checked, Doing cut n paste is an option, but very tedious.

What are the alternative offline validation options for HTML / CSS pages?

+6
html css php apache localhost
source share
5 answers
+5
source share

Firefox Web Developer Toolbar has a Check Local option.

+2
source share

Try the HTML Validator extension for Firefox - it works locally.

+2
source share

You can load a local page using curl and then check it with a local validator or message using curl in the W3 Validator or your online HTML validator of your choice. Or you can write a simple web spider in some scripting languages ​​and bypass the local network, checking each page as a scan. An example crawler class in Perl:

 package Test::Crawler; use Moose; use WWW::Mechanize; has client => ( is => 'ro', isa => 'WWW::Mechanize', default => sub { WWW::Mechanize->new }, ); has handler => ( is => 'ro', isa => 'CodeRef', default => sub {}, ); sub crawl { my ($self, $url, $visited) = (@_, {}); # Already seen that. return if $visited->{$url}++; # Not seen yet, get. $self->client->get($url); $self->handler->($url, $self->client); # Follow all links. my @uris = map { $_->URI } $self->client->links; for my $uri (@uris) { # Skip mailtos, ftp and such. next if $uri->scheme; # Skip external links. next if $uri->host; $self->crawl($uri->rel, $visited); } } 

And a sub sample to check with validator.nu :

 sub is_valid { my ($code, $page_url) = @_; my $ua = LWP::UserAgent->new; my $url = 'http://validator.nu/?out=gnu'; my $response = $ua->post($url, Content_Type => 'text/html', Content => $code); return $response->as_string !~ /error/; } 
0
source share

I look at this rather old question, looking for the same thing. Here is what worked for me:

 $ curl -H "Content-Type: text/html; charset=utf-8" \ --data-binary "$(curl http://localhost:8080/url/to/test)" \ https://validator.w3.org/nu/?out=gnu 

See documents .

0
source share

All Articles