Skip to content

Instantly share code, notes, and snippets.

View lentisgr's full-sized avatar
💭
I may be slow to respond.

lentisgr

💭
I may be slow to respond.
View GitHub Profile
@lentisgr
lentisgr / cors.md
Created October 31, 2019 03:46 — forked from jesperorb/cors.md
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin
@Znote
Znote / postback.php
Last active January 26, 2020 07:28
AdWorksMedia IPN script for Znote AAC
<?php
require_once 'engine/init.php';
/*
MySQL table:
CREATE TABLE IF NOT EXISTS `znote_awm` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL DEFAULT '0',
`json` text NOT NULL,
PRIMARY KEY (`id`)
<!-- Modify this according to your requirement -->
<h3>
Redirecting to duckdev.com after <span id="countdown">10</span> seconds
</h3>
<!-- JavaScript part -->
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/