Skip to content

Commit

Permalink
Merge pull request #7 from krishnprakash/alert-autofix-1
Browse files Browse the repository at this point in the history
Fix code scanning alert no. 1: DOM text reinterpreted as HTML
  • Loading branch information
krishnprakash authored Nov 5, 2024
2 parents 4867110 + b86ec8b commit 297bcad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
$('#small-nav-dropdown').change(function() {
window.location = $(this)
var selectedValue = $(this)
.find('option:selected')
.val()
.val();
if (/^https?:\/\/[^\s/$.?#].[^\s]*$/.test(selectedValue)) {
window.location = selectedValue;
} else {
console.error('Invalid URL:', selectedValue);
}
})

const site_tag = 'UA-62780441-30';
Expand Down

0 comments on commit 297bcad

Please sign in to comment.