Fixes.
This commit is contained in:
25
index.php
25
index.php
@@ -98,6 +98,10 @@ $twitter_card_image = "https://ukdataservices.co.uk/assets/images/ukds-main-logo
|
||||
|
||||
<!-- Resource Preloading for Performance -->
|
||||
<link rel="preload" href="assets/css/main.min.css" as="style">
|
||||
|
||||
<!-- Google reCAPTCHA v3 -->
|
||||
<?php require_once '.recaptcha-config.php'; ?>
|
||||
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo RECAPTCHA_SITE_KEY; ?>"></script>
|
||||
<link rel="preload" href="assets/images/ukds-main-logo.webp" as="image">
|
||||
<link rel="preload" href="assets/js/main.min.js" as="script">
|
||||
|
||||
@@ -920,6 +924,7 @@ $twitter_card_image = "https://ukdataservices.co.uk/assets/images/ukds-main-logo
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-full">Submit Enquiry</button>
|
||||
<input type="hidden" name="recaptcha_response" id="recaptchaResponse">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -985,6 +990,26 @@ $twitter_card_image = "https://ukdataservices.co.uk/assets/images/ukds-main-logo
|
||||
<!-- Scripts -->
|
||||
<script src="assets/js/main.min.js"></script>
|
||||
|
||||
<!-- reCAPTCHA v3 Integration -->
|
||||
<script>
|
||||
// Execute reCAPTCHA on form submission
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const contactForm = document.querySelector('form[action="contact-handler.php"]');
|
||||
if (contactForm) {
|
||||
contactForm.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
grecaptcha.ready(function() {
|
||||
grecaptcha.execute('<?php echo RECAPTCHA_SITE_KEY; ?>', {action: 'contact'}).then(function(token) {
|
||||
document.getElementById('recaptchaResponse').value = token;
|
||||
contactForm.submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Service Worker Registration -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
|
||||
Reference in New Issue
Block a user