Posts Tagged with header

Displaying 1-5 of 5 results.
Resolved: Access to Font at from origin has been blocked by CORS policy
posted by admin on August 4, 2017
I have two websites - two different domains.
In style css I have font-face and include fonts from the same domain

@font-face {
font-family: "wr-icons";
font-style: normal;
font-weight: 400;
src:
url("../font/cbh-icons.eot") format("embedded-opentype"),
url("../font/cbh-icons.woff") format("woff"),
url("../font/cbh-icons.ttf") format("truetype"),
url("../font/cbh-icons.svg") format("svg");
}

It is working perfect on fonts owner domain, But when I trying to include from these fonts from the seconds domain, I got an errors like

Access to Font at 'https://isystems.am/font/cbh-icons.ttf' from origin 'http://lifestyle.am' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://lifestyle.am' is therefore not allowed access.

Server Side is Ubuntu 16.04 with NginXRead more
Wiki: How to make an AJAX call without jQuery with GET and POST?wiki
posted by admin on March 27, 2017
Using the following snippet you can do similar things pretty easily, like this:

ajax.get('/test.php', {foo: 'bar'}, function() {});

Here is the snippet:

var ajax = {};
ajax.x = function () {
if (typeof XMLHttpRequest !== 'undefined') {
return new XMLHttpRequest();
}
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp.2.0",
"Microsoft.XmlHttp"
];

var xhr;
for (var i = 0; i < versions.length; i++) {
try {
xhr = new ActiveXObject(versions[i]);
break;
} catch (e) {
}
}
return xhr;
};

ajax.send = function (url, callback, method, data, async) {
if (async === undefined) {
async = true;
}
var x = ajax.x();
x.open(method, url, async);
x.onreadystatechange = function () {
if (x.readyState == 4) {
callback(x.responseText)
}
};
if (method == 'POST') {
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
}
x.send(data)
};

ajax.get = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url + (query.length ? '?' + query.join('&') : ''), callback, 'GET', null, async)
};

ajax.post = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url, callback, 'POST', query.join('&'), async)
};
Read more
Resolved: Wordpress enqueue include style.css in header head
posted by admin on March 14, 2016
I want to know the right way to enqueue include style.css in header head.Read more
Not Resolved: Adding a Stylesheet to the Header
posted by admin on March 9, 2016
I want to include stylesheet files from functions.php like javascript file wp_register_script and wp_enqueue_script, but for css files in header.phpRead more
Resolved: WordPress deregister register enqueue script
posted by admin on March 9, 2016
Include JavaScript jQuery file to wordpress header, in functions.phpRead more