This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06d9867
commit 3a0a13b
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const select = document.querySelector('select'); | ||
select.addEventListener('change', event => { | ||
const option = event.target.value; | ||
|
||
if (option === 'blob') { | ||
let htmll=document.querySelector("html"),html=htmll.innerHTML; | ||
html+="</html>",html="<!doctype html> <html> "+html; | ||
let htmlA=Array(html); | ||
const blob=new Blob(htmlA,{type:"text/html"}); | ||
let blobUrl=URL.createObjectURL(blob); | ||
open(blobUrl),URL.revokeObjectURL(blobUrl); | ||
} else if (option === 'popup') { | ||
var url = window.location.href; | ||
var myWindow1 = window.open('about:blank',height='300',width='500'); | ||
myWindow1.document.write('<iframe src=${url}></iframe>'); | ||
window.location.replace('https://google.com/'); | ||
} else if (option === 'ab') { | ||
var url = window.location.href; | ||
var urlObj = new window.URL(window.location.href); | ||
win = window.open(); | ||
win.document.body.style.margin = "0"; | ||
win.document.body.style.height = "100vh"; | ||
var iframe = win.document.createElement("iframe"); | ||
iframe.style.border = "none"; | ||
iframe.style.width = "100%"; | ||
iframe.style.height = "100%"; | ||
iframe.style.margin = "0"; | ||
iframe.referrerpolicy = "no-referrer"; | ||
iframe.allow = "fullscreen"; | ||
iframe.src = url.toString(); | ||
win.document.body.appendChild(iframe); | ||
window.location.replace("https://google.com/"); | ||
} | ||
select.option = "Open in..."; | ||
}); |