Stylelint shows "Unexpected URL scheme "data" if I use SVGs as background in my CSS - stylelint

I'm using some SVG images in the CSS file like this:
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='%23637581' d='M101.3 141.6v228.9h309.5V141.6H101.3zm274.4 26.2L256 259.3l-119.6-91.5h239.3zm-248.1 26.3l64.1 49.1-64.1 64.1V194.1zm.2 150.1l84.9-84.9 43.2 33.1 43-32.9 84.7 84.7H127.8zm256.6-36.4L320 243.4l64.4-49.3v113.7z'/%3E%3C/svg%3E");
It works. However Stylelint is complaining with this error:
Unexpected URL scheme "data:" function-url-scheme-disallowed-list
Does anyone know how to fix the URL to get rid of the stylelint error?

Stylelint is only complaining about the data scheme because it's been configured to do that via the function-url-scheme-disallowed-list rule. There's nothing wrong with the URL, and disallowing the data scheme is purely a preference.
Neither of the official configs turn this rule on. Either you or the author of the 3rd party config you're extending has turned it on and configured it to disallow the data scheme.
You'll either need to:
find out why that is, and use whatever alternative is suggested
turn the rule off or configure it allow the data scheme

Related

Detecting when GWT uses a fallback user.agent property?

There's a number of threads I've found on GWT's handling when it can't find a permutation for a browser i.e. returning of "unknown" which then becomes an attempt to GET a resource named /undefined.cache.js
I've also read and understood how you can use fallback properties to workaround this by setting a fallback user.agent property when no browser permutation is found (suggestions are 'safari' or 'gecko1_8').
What I can't find is a way to detect that the user.agent string has been set from a fallback property so we can popup a message to warn the user they are on an unsupported browser and the UI may not functional fully. In a couple of threads there are vague references to using deferred binding. I'm not an expert in that, although I understand the basic concept, and I can't quite see how that helps - how would deferred binding tell the difference between a user.agent which is actually a 'safari' compatible browser, and hence supported, vs the fact that 'safari' was chosen as fallback for an unsupported browser. Without that, I can't see a way to warn the user.
Hopefully I'm missing something here - at present, I'm on the verge of the much more brittle approach of altering our server to return an HTML error page for that undefined.cache.js resource fetch.
Use UserAgent and compare the runtime vs compile time values. The compile time value does not take into account the fallback value.

Configure TinyMCE in Typo3 to run over HTTPS

we are using Typo3 7.6.6 for our new homepage. To simplify the process of writing new articles, we introduced the extension TinyMCE4 as TYPO3 RTE. On our test-system tinyMCE works fine, the editors are satisfied.
To prepare for production environment we introduced SSL. Hence the homepage is referenced over https://....
Since this change tinyMCE no longer appeared. After some research we found out, that the tinyMCE extension tries to load a specific dynamically generated js-file tinymceConfiguration....js over HTTP (not over SSL as preferred).
Since we have a strict policy, the server doesn't allow the client to catch the script without using SSL. Unfortunately we cannot change that policy.
The question is: where does the extension get the URL from. Can I overwrite it to reference the https://.. path?
I already tried changing
config.baseURL
tinyMCE.init({
...
document_base_url : "https://.."
});
But it didn't work.
Does anybody have an idea?
Regards,
Thomas
you could try to tell your browser to use "Content-Security-Policy" in that way all http links are rewriten by the browser itself. Maybe the lazy way.
https://developers.google.com/web/fundamentals/security/encrypt-in-transit/why-https?hl=en
http://www.html5rocks.com/en/tutorials/security/content-security-policy/
Regards
Pete

Wildfly always sending content-type html

I'm migrating an app from jboss as 6 to wildfly 9.0.2.
The app is deploying and working, but I noticed something strange.
We have a login page in webapp/login/login.jsp, and it's assets are in webapp/login/ too. Those assets are always transferred with the Content-Type header set to text/html.
I tried to remove all filters (including struts, for example), but still the content-type is wrong.
I tried to declare the mime-type mapping in web.xml for css and js files, also didn't work.
I even tried to set up a filter to override the content-type, and too didn't work.
I'm out of options here, does anyone ever seen anything like that?
I found the error.
We have an internal framework (yeah, I know), developed by a former architect, and the framework was declaring a #WebFilter("/*") and changing all requests' content-types.
I guess Jboss AS mime-type filter were running after that crappy stuff, and fixing it's mistakes, and undertow's filter is probably running earlier, causing the broken requests.
Either way, I fixed that thing and now it's working.
you should rewrite content-type in frontend web server (such as apache) or add these mime-mapping configuration in web.xml of application:
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>

umbraco tiny mce absolute urls

i'm having a issue on tiny mce on umbraco 6.
When i add a image or link on tinymce the urls are converted from
http://domainx.com/images/someimage.png
to
domainx.com/images/someimage.png
i've added a few configurations to tinyMceConfig.config
<config key="relative_urls">false</config>
<config key="convert_urls">false</config>
<config key="remove_script_host">false</config>
but now url's are created without the http or https wich results in wrong path and we can't see the images on the tinymce.
Did you configure any hostname on any node? If so, add the missing part.
What you are describing is a function of TinyMCE and not Umbraco itself. I don't have enough "Rep" to comment, otherwise I would ask what version of TinyMCE is installed/running in your version of Umbraco.
However, while it would appear as though you are on the correct path with your configurations, the documentation (http://wiki.moxiecode.com/index.php/TinyMCE:FAQ) says you need to simply add "convert_urls = false" to the customConfig section of tinyMceConfig.config (like below), the Umbraco community appears to be reporting it as a bug (http://issues.umbraco.org/issue/U4-374).
<customConfig>
<config key="convert_urls">false</config>
...
</customConfig>
Have you tried using //www.example.com rather than http://www.example.com as a possible workaround?
It is possible to do custom configuration settings for TinyMCE in umbraco (documentation).
I couldn't find a correct documentation for changing settings, which are of the type boolean, to false.
After a while and changing some settings I needed, i've found a way to do it! Just leave the value empty in the customConfig-section:
<customConfig>
<config key="convert_urls"></config>
</customConfig>
This resulted in being able to enter (almost) anything as a link, without it being converted.

Making GWT application crawlable by a search engine

I want to use the #! token to make my GWT application crawlable, as described here:
http://code.google.com/web/ajaxcrawling/
There is a GWT sample app available online that uses this, for example:
http://gwt.google.com/samples/Showcase/Showcase.html#!CwRadioButton
Will serve the following static webpage to the googlebot:
http://gwt.google.com/samples/Showcase/Showcase.html?_escaped_fragment_=CwRadioButton
I want my GWT app to do something similar. In short, I'd like to serve a different flavor of the page whenever the _escaped_fragment_ parameter is found in the URL.
What should I modify in order for the server to serve something else (a static page, or a page dynamically generated through a headless browser like HTML Unit)? I'm guessing it could be the web.xml file, but I'm not sure.
(Note: I thought of checking the Showcase app provided with the GWT SDK, but unfortunately it doesn't seem to support serving static files on _escaped_fragment_ and it doesn't use the #! token..)
If you want to use web.xml, then I think it won't work with a servlet-mapping, because the url-patterns ignore the get parameters. (Not 100% sure, if there is another way to make this possible.)
You could of course map Showcase.html to a servlet, and in that servlet decide what to do, based on the get parameter "_escaped_fragment_". But it's a little bit expensive to call a Servlet just to serve a static page for the majority of the requests (not too bad, but still. You could set cache headers, if you're sure that it doesn't change).
Or you could have an Apache or something in front of your server - but I understand, I wouldn't like to have to do that either. Maybe your JavaEE server (which one are you using BTW?) provides some mechanism for URL filtering before the request gets passed on to the web container - I'd like to know that, too!
Found my answer! The Showcase sample supporting crawlable hyperlinks is in the following branch:
http://code.google.com/p/google-web-toolkit/source/browse/branches/crawlability/samples/showcase/?r=7726
It defines a filter in the web.xml to redirect URLs with the _escaped_fragment_ token to the output of HTML Unit.