How to auto check specific websites for errors with Chrome or Firefox extension? - html-validation

I'm looking for a Chrome or Firefox extension that will auto validate your webpages from specific URLs.
I don't want to auto-check everything I browse, only the specified URL patters or domain names.
The validation doesn't have to be perfect, but has to be pretty fast and find things like
missing images, css or js files.
JavaScript warnings/errors.
invalid links (404 ones)

Related

Why are .html file parsed rather than compiled when open them in browser such as Safari?

Why are .html file parsed rather than compiled when open them in browser such as Safari? From the internet, I learned that parser is a component of a compiler. People say .html is parsed to a web page, but why not compiled to a web page? .html file contains code that needed to be compiled so that it becomes a webpage, right?
Some possible reasons: Maybe when we say something is compiled, it has to be compiled into machine language but .html does not?
HTML does not get compiled - it simply describes how the website should be rendered.
And that is then interpreted by the browser - it doesn't end up as machine code.
It's like a map or blue prints telling the browser's rendering engine how to build the website.
The W3C defines how these "plans" should be written and the browser vendor should make sure they interpret the plans in the correct way.
Developers should make sure they use the HTML elements properly so that the HTML files make sense and the browser can construct the web page properly.
What difference does it make? You have not described a problem you are having.
The parsing of HTML is application-dependent. Each browser/parser decides how to do it.
HTML however must be dynamically modifiable. Since HTML is not executed, it is not clear what the difference is between compiling and interpreting but typically compiled code can't be easily modified.
JavaScript is by definition interpreted.

Adding a CSP to a Firefox extension's own HTML page

I have a Firefox extension displaying its own HTML page via a chrome:// url, and scripts in it are running with chrome privileges. For users' security, I want to add a Content Security Policy to this page.
The obvious thing to do is to add it via <meta> tag, but that's not yet supported in Firefox (bug 663570). Update: Bug 663570 was fixed in Firefox 45, but my attempts to use a tag caused Firefox to crash. Bug 923902 seems to be the new bug to watch.
Is there any way to implement a CSP right now? Some way to fake the appropriate HTTP header for a chrome:// URL?
I asked this question waaay back in the days of XUL add-ons, which are long gone - in this era of WebExtensions, I could define a CSP in manifest.json, although the default CSP is plenty secure.

TIdHTTPServer seems to be ignoring connections sometimes

Using Delphi XE6, I've written lots of service applications that use TIdHTTPServer. Every now and again, a javascript file will fail to load in Firefox, and when I check the Delphi application's log, there's no mention of it.
Example:
In TIdHTTPServer.OnCommandGet, first thing I do is log the requested page. After the page loads in Firefox, the log shows the page request, 3 CSS requests and 3 JS requests - for this example it is correct. But sometimes, and it's usually after I haven't requested the page for a while, despite closing Firefox, and the Delphi service application, one of the JS requests is missing, and it's not loaded in Firefox, so things don't work.
Not sure if it's relevant, but one of the techniques I use is appending the file's last modified timestamp code as a parameter when requesting the file.
eg. in the HTML, it will say <script type="text/javascript" src="general.js?rnd=20150522155113"></script>
I do this to ensure updates to JS and CSS files are always reloaded and not cached.
I'm not sure how to go about solving this. The issue affects multiple delphi projects. I only use Firefox, so not sure if other browsers are affected. Any help is appreciated.

Font Awesome with Bootstrap SASS

I have a rails 4 app.
My font awesome icons have worked until recently. Now, instead of my social media icons, i have black squares (I can't see why those have replaced the coloured icons I've been using). The links work. The tags are the same as they always have been and the same as the font awesome directions.
I installed font awesome using the sass gem. I require font-awesome, just above self in my application.css.scss.
I have the current gem installed (4.2.0).
For what it's worth - this is my footer with the links I'm using:
<i class="fa fa-youtube fa-2x"></i>
Any advice?
Thank you
You can use Chrome developer tools, firebug or any similar type of tools to check a few things. Firstly you want to make sure the font has downloaded. Using the network tab of Chrome developer tools, you can see outgoing requests and the responses that were made in order to serve the page. Check to see if a request was made for the font file.
Two possible scenarios are the
No request was made for the font. This would indicate a problem with your font declarations in the #media query of your CSS file.
A request was made for the font but it returned an error code.
If an error code is returned you need to determine why that is the case. For example a 404 indicates that the server could not locate the requested file in the specified location, so obviously you need to check that the file is there. Another thing to check is that the web server is configured to respond correctly to requests for fonts by serving the files. I have come across cases where 404 errors are thrown because the web server does not serve, or is explicitly disallowing requests for .woff files, which makes the 404 error somewhat misleading.
If the request for the font files is being made and the server is responding with a success code (200, 302 etc), then it may be a problem with the styling of your HTML element.
Using the tools mentioned above you can also 'Inspect' the HTML element, generally by right clicking on it and selecting a menu option along those lines (In chrome it is 'Inspect Element'). You should be able to see a rundown of each element and where the styles are coming from similar to this image.
There you should be able to find out if something is overriding your styles.

Firefox question: Is it possible to create an html iframe which loads a document from my extension using the chrome://?

I was wondering if it is possible to create an iframe whithin a HTML document pointing to a XUL document whithin my firefox extension such like:
<iframe src="chrome://myextension/content/document.xul"/>
I am currently getting security errors when trying to do this. I've already tried the contentaccessible=yes flag in my chrome.manifest but it didn't work.
Is there any workaround to get this working?
Thanks.
No, web pages are generally not allowed to load chrome documents. contentaccessible=yes refers to images and scripts that are less regulated security-wise (they can also be used across domains). However, your extension has permission to load chrome documents - even into a content page. So doing something like this from your extension will work:
window.content.frames[0].location.href = "chrome://myextension/content/document.xul";
Not sure whether this will help you, depends on what you are trying to achieve.

Resources