Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainflare Embed Version #60

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
102 changes: 70 additions & 32 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="X-Frame-Bypass: Web Component extending IFrame to bypass X-Frame-Options: deny/sameorigin">
<title>X-Frame-Bypass Web Component Demo</title>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
iframe {
display: block;
width: calc(100% - 40px);
height: calc(100% - 40px);
margin: 20px;
}
img {
position: absolute;
top: 0;
right: 0;
}
</style>
<script src="https://unpkg.com/@ungap/custom-elements-builtin"></script>
<script src="x-frame-bypass.js" type="module"></script>
</head>
<body>
<iframe is="x-frame-bypass" src="https://news.ycombinator.com/"></iframe>
<a href="https://github.com/niutech/x-frame-bypass"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
</body>
<html lang="en">
<head>
<title>Chainflare Embed</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Description" content="Chainflare Embed" />
<meta name="Author" content="Made in one click" />
<meta name="Copyright" content="Unlicense" />
<meta name="Keywords" content="Chainflare, Embed, Unlicense" />
<meta name="Subject" content="Chainflare Embed" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Chainflare Embed">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="mobile-web-app-capable" content="yes">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="400">
<meta name="format-detection" content="telephone=no">
<meta name="google" content="notranslate">

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="cleartype" content="on">
<meta http-equiv="Content-Language" content="en">

<style>
html, body, iframe {
margin:0;
padding:0;
top:0;
left:0;
bottom:0;
right:0;
height:100%;
z-index:999999;
}
iframe {
overflow:hidden;
display:block;
width:100%;
border:none;
}
.background {
background-color: #44034f;
}
</style>

<script src="https://unpkg.com/@ungap/custom-elements-builtin"></script>
<script src="x-frame-bypass.js" type="module"></script>

</head>
<body>
<iframe is="x-frame-bypass" id="flex" name="flex" title="flex"></iframe>
<script>
// Extract URL parameter
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var targetURL = urlParams.get('url');

// Set default URL
var finalURL = 'https://example.com';

if (targetURL) {
var urlWithoutProtocol = targetURL.replace(/^(https?:\/\/)/, '');
document.getElementById('flex').src = 'https://' + urlWithoutProtocol;
} else {
document.getElementById('flex').src = finalURL;
}
</script>
</body>
</html>
7 changes: 4 additions & 3 deletions x-frame-bypass.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ customElements.define('x-frame-bypass', class extends HTMLIFrameElement {
}
fetchProxy (url, options, i) {
const proxies = (options || {}).proxies || [
'https://cors-anywhere.herokuapp.com/',
'https://yacdn.org/proxy/',
'https://api.codetabs.com/v1/proxy/?quest='
// by default use a CORS proxy to bypass X-Frame-Options DENY/ALLOWALL
'https://api.allorigins.win/raw?url=',
// Proxy alternatives i.e. my test'https://go.kinkyl.ink/raw?url=',
// More ...
]
return fetch(proxies[i] + url, options).then(res => {
if (!res.ok)
Expand Down