diff --git a/src/views/pages/marketing/MarketingAnalysis.vue b/src/views/pages/marketing/MarketingAnalysis.vue
index 30df7d4..a664e1b 100644
--- a/src/views/pages/marketing/MarketingAnalysis.vue
+++ b/src/views/pages/marketing/MarketingAnalysis.vue
@@ -551,7 +551,7 @@
{
const handleRowClick = (competitor) => {
if (competitor.website) {
- window.open(competitor.website, '_blank', 'noopener,noreferrer');
+ let url = competitor.website.trim();
+ // If URL doesn't start with http:// or https://, add https://
+ if (!url.match(/^https?:\/\//i)) {
+ url = 'https://' + url;
+ }
+ window.open(url, '_blank', 'noopener,noreferrer');
}
};
+const getFullUrl = (url) => {
+ if (!url) return '';
+ const trimmed = url.trim();
+ // If URL doesn't start with http:// or https://, add https://
+ if (!trimmed.match(/^https?:\/\//i)) {
+ return 'https://' + trimmed;
+ }
+ return trimmed;
+};
+
const formatWebsite = (url) => {
if (!url) return '';
+ const trimmed = url.trim();
try {
- const urlObj = new URL(url);
- return urlObj.hostname.replace('www.', '');
+ // If it's already a full URL, parse it
+ if (trimmed.match(/^https?:\/\//i)) {
+ const urlObj = new URL(trimmed);
+ return urlObj.hostname.replace('www.', '');
+ }
+ // Otherwise, just return the domain part (before first /)
+ const domain = trimmed.split('/')[0];
+ return domain.replace('www.', '');
} catch {
- return url;
+ // If parsing fails, return as is (might be just domain name)
+ return trimmed.split('/')[0].replace('www.', '');
}
};
|