How-To Implement Cross-Browser #font-face Support in rails - ruby-on-rails

I am developing a small rails app to serve fonts to other sites
say a request http://url/fonts/fontname will return woff,eot or ttf font based on the browser type.
This app is working fine in my localhost but not in other ip... I know the problem is something to do with Cross-Origin Resource Sharing restriction but don't know how to solve this....
I am using Mongrel...

You said you have access to the other sites' files.
Well then you just need to add Header set Access-Control-Allow-Origin * to your .htaccess file on the targeted websites.
source

Related

Joomla base URL incorrectly formulated

Somehow my Joomla after an upgrade from 3.4.7 to 3.4.8 is not formulating the base URL properly. The base is supposed to be "www.domain.com/en-us/" for the English version of the site. It renders the following as the base url "www.domain.comhttp://www.domain.com/en-us/www.domain.com/"
further rendering the following url for resources, such as for "green_leaf.png": "www.domain.comhttp://www.domain.com/en-us/www.domain.com/images/green_leaf.png". Consequently, the pages full missing page elements.
SEF is enabled. Multi Language Filter Plugin is enabled. Any ideas what could be the cause of this besides, the configuration and the htaccess files? Those file are pretty standard.
The first things I would confirm are
- in system > global configuration > site -- is URL rewriting set to yes and have you renamed htaccess to .htaccess?
- if yes then ftp to your site, open configuration.php in a text editor, locate the line setting the $live_site variable and change to
public $live_site = 'http://www.domain.com';
Good luck!
I have tried your suggestion, to specify the $live_site variable in the configuration.php file as you indicate, even though I have also been recommended to leave it empty. The results were the same, the issue remains.
Here is the latest on this matter:
I have created a local copy of the site on my machine from a backup that was still Joomla 3.4.7. The same issue appears. I have reverted back to an earlier backup with Joomla 3.4.6 version of the site, and the site's page was restored to normal. This is with the same exact .htaccess and configuration.php across the 3 Joomla versions.
I have also tried with "Options +FollowSymLinks" commented out in the .htaccess file that came with J3.4.8. On both the live hosted site and a locally hosted copy, same exact results, namely:
Using Google Chrome (with Language Filter Enabled and set to Remove URL Language Code)
On the live hosted site:
www.domain . comhttp://www.domain.com/www.domain.com/
On the localhost copy of the site: localhost/domainfolder/localhost/domainfolder/http://localhost/domainfolder/localhost/domainfolder/domainfolder
So this issue might be pertaining to Joomla versions 3.4.7 and 3.4.8. The challenge is that 3.4.6 also has critical security vulnerabilities.
Also tried with Language Filter Disabled - Same result (Base URL formulated as above) with the difference that all the languages are displayed at the same time on the home page with the resources that are not found because of the faulty base url.

AngularJs Routing | don't change URL

I am developing an App that uses the AngularJs Router.
So my URLs look like that:
appName/viewOrders
My problem is, when I refresh the browser with F5 I get an 404 Error. (Because there isn't a folder or even file named viewOrders)
I can't redirect it via a config file because I am not able to use one in the environment where I am developing (An Sharepoint 2013 App).
So I came to this idea:
When I click the navigation, the Url doesn't change and stays at
/appName
But the view does it.
How can I achieve it? Have I to use the ui-router?
If you have restricted access and are unable to use the answer #tommyd456 (which it sounds like that may be the case), another option is to omit the url completely using stateProvider (ui-router).
Angular ui-router: Can you change state without changing URL?
Not sure if you've solved this issue but here's a potential solution anyway...
You're using HTML5 mode so you need server-side rewrite as explained here: https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode
However, it sounds like you've got restricted access to a server so why stop HTML5 mode.
Don't hack at it like you're suggesting - that could get nasty.

Is a URL starting with // valid?

We can see many HTML page using src="//example.com/myjavascript.js" to include a .js and let the browser use http:// / https:// depending on the current scheme of the page URL.
Is this a valid URI ?
Yes, it is definitely valid. It is a "scheme relative" or "protocol relative" URI. In the spec since the beginning. Quite helpful to deal with http/https issues.
Read a much better description and caveats:
Is it valid to replace http:// with // in a <script src="http://...">?
A few points to keep in mind:
There are some minor issues on IE 7 & 8 with double downloads
If you are viewing an HTML page from a file the browser will replace the scheme with file://, and not load your JS file from the server like it would with a full URL starting with http:// or https://.
Edit for modern webdev practices:
While the URL is still valid, it is now recommended to use https for third party resources (and, serve those resources from secure pages). The performance or compatibility issues from years ago are largely resolved with updated protocols and browsers.
As a warning... we encountered issues with this methodology NOT being supported in Internet Explorer when used inside the HTML BASE tag (IE8 and 9 confirmed, didn't test any others before patching the issue).
After newly implementing SSL on a website, we had initially updated the BASE tags across the application to simply reference "//www.mydomain.com" : but the page templates broke (in IE only) on all scripts which did NOT live at the root of the site. Makes sense, since the BASE tag was not picking up the stylesheet or other relatively-linked resources which assumed they were being referenced from root, not from a nested location.
Since the BASE URI was our own domain anyway, we fixed the issue by setting the BASE tag's value to "https://www.mydomain.com". No matter if the client is browsing the site in SSL mode or out, at least it will work cross-browser now and can ALWAYS find its content - and by forcing https at all times, we ensure we don't get any content-mismatch warnings in the process by setting the BASE path to an http location while browsing a page using https.
It is valid indeed and I have just learned this in the hard way!! We broke a customization feature so you should always validate an URL like this (in .NET):
Pay attention to:
White spaces (Trim)
"scheme relative" URI (UriKind.RelativeOrAbsolute)
public bool IsValidUrl(string resourceUrl)
{
Uri uri;
if (Uri.TryCreate(resourceUrl.Trim(), UriKind.RelativeOrAbsolute, out uri))
{
return uri.IsWellFormedOriginalString();
}
return false;
}

What is a website that ends with a .sd extension?

I know there are:
.aspx
.php
.html
.htm
This is the first time I'm seeing a website with .sd at the end. What exactly does that mean and is there a wiki that explains a bit more?
For example, this website:
http://www.racingpost.com/horses2/results/home.sd
First time I'm seeing it and I'm just curious.
Because the choice of extension is practically meaningless on the web - the content-type header defines the actual format of the content - there are lots of exotic extensions around, mostly defined by the CMS or framework used. I'm pretty sure this is not an "own format" in the sense that "html", "aspx" and "php" differ from each other internally by containing raw HTML, PHP code, or ASP code, but just a "vanity extension" if you will.
Can you show us the web site in question? Maybe somebody can hazard a guess what CMS/platform it was built with.
Edited for the url you added: that specific one is most likely being used with the BlueDragon system, a family of runtime server-side products for the deployment of CFML pages, deployed in possibly a j2ee environment.
for instance you can google the site for references:
http://www.google.com/search?q=site%3Anewatlanta.com+%22sd
or see a servlet debug page:
http://74.125.93.132/search?q=cache:yg7UIh6nRdIJ:www.lucasoil.com/landing_pages/14,3.html/+%22index.sd%22+bluedragon&cd=2&hl=en&ct=clnk&gl=us&client=firefox-a
or you may be referring to the TLD (top-level domain name).
the TLD .sd belongs to country of Sudan which is managed by the Sudan Internet Society:
http://www.isoc.sd/sudanic.isoc.sd/
.sd could be anything. According to Fileinfo.com it is the default extension for some type of audio file.
However, I could make a php page called index.sd and as long as I have my webserver configured in the correct way, it would serve it up as php. That goes for other things as well, .html, .py, .pl... etc, etc.
I would just need to add this to my configuration file for apache:
AddType application/x-httpd-php .sd
According to fileinfo .sd is an audio file.
The Top Level Domain .sd denotes Sudan.
Other than that, you can come up with any extension you want (or even use an existing one) and point it to any handler you want, say, in your web server, or in your code. (In the .NET world, you can define your own MIME types through IIS, or setup Http Handlers in your web.config)
Good old "view source" shows that it is just HTML.
At a guess, it's probably one of the above - it's pretty trivial to get a webserver to arbitrarily treat a file as whatever you want irrespective of its extension.
.sd is for SUDAN
like .in for India
.us for USA

How can I get browsers other than IE to accept file urls?

It is not uncommon for our intranet web applications to link to publications, documents, or other resources from our shared network file servers.
In the past, we've had little trouble fashioning links such as the following:
file://fileserver1/folderofgoodies/rules.pdf
\\fileserver1\folderofgoodies\rules.pdf
The reason we had no trouble is because everyone in the building uses IE6 or IE7 (very few have IE8). Both styles of URLs worked fine in Microsoft browsers it seems.
But if you try clicking such links in other browsers, specifically Firefox, nothing happens!
On a new intranet web app I'm developing I've been attempting to ensure cross-browser support, but any links to local computer or local network resources seem to be ignored in at least Firefox 3.5.3, though I admit I haven't yet checked other browsers.
Is there any way I can change the way I link to said files so that browsers like Firefox will accept them? I cannot do anything that requires installing scripts, software, extensions, or any other solution on a per-user/per-computer basis.
I realize the suppression of said links is a security thing, but these links would be originating from only trusted local intranet locations, so...
If this is intranet, you can build a little helper server/page/webservice/whatever to which you will link and pass file name as parameter:
http://server/getlocalfile?path=file://fileserver1/folderofgoodies/rules.pdf
And you will benefit from extended security, by the way.
I think your only option is reconfiguring Firefox, but unfortunately you said you can't do that.
You could just map the file server path as a virtual directory into your intranet site and link via http.
Mozilla applications block links to local files. The only way is to install plugin(s) to Firefox. This link describes some of them.

Resources