diff --git a/index.html b/index.html index 20cd3be..f0b7606 100644 --- a/index.html +++ b/index.html @@ -1152,7 +1152,7 @@
diff --git a/src/main.ts b/src/main.ts index 288a1fb..859f4d1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -758,6 +758,10 @@ class MotifApp { const title = this.cleanSongTitle(result.title || 'a song'); + // Open window immediately (must be in user gesture context for mobile) + // We'll navigate it after getting the share URL + const popup = window.open('about:blank', '_blank'); + // Get share URL (try short link first) let shareUrl: string | null = null; try { @@ -789,7 +793,13 @@ class MotifApp { const tweetText = `I made ${title} Game Boy version.\n\n16-Bit Midi Wario Synth by @b1rdmania`; const twitterUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}&url=${encodeURIComponent(shareUrl)}`; - window.open(twitterUrl, '_blank', 'width=550,height=420'); + // Navigate the already-opened window + if (popup) { + popup.location.href = twitterUrl; + } else { + // Fallback if popup was blocked + window.location.href = twitterUrl; + } } private setState(state: 'idle' | 'results' | 'selected' | 'generated'): void {