Add test.html
This commit is contained in:
parent
db414cfcff
commit
9436fc4683
1 changed files with 51 additions and 0 deletions
51
test.html
Normal file
51
test.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Share Functionality Example</title>
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background-color: #f0f0f0;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
button {
|
||||
padding: 15px 30px;
|
||||
font-size: 16px;
|
||||
color: white;
|
||||
background-color: #007bff;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button id="shareButton">Share This Page</button>
|
||||
|
||||
<script>
|
||||
document.getElementById('shareButton').addEventListener('click', function() {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
title: 'Check out this page!',
|
||||
text: 'This is a simple example of a share functionality.',
|
||||
url: window.location.href
|
||||
})
|
||||
.then(() => console.log('Share successful'))
|
||||
.catch((error) => console.error('Error sharing:', error));
|
||||
} else {
|
||||
alert('Share not supported on this browser.');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue