zoenightshade
zoenightshade

Reputation: 159

My html link only opens with open in new tab?

My code has been working fine before but since I added the onlick part, i can no longer access it on left click. I have to open it in new tab.

<a onclick="event.preventDefault(); window.parent.postMessage('link_url:'+this.href,'*');" href="?redirect=Pro" class="btn btn-accept display-5" target="_blank">I AGREE</a>

I cant remove that part since I need it otherwise my other redirect links from another php file wouldnt work. If i remove it, I cant redirect properly. Kindly asking for advice on how to fix this so I can open with left click or at least automatically open in new tab on left click. Thanks in advance.

Upvotes: 2

Views: 825

Answers (1)

Sakkeer A
Sakkeer A

Reputation: 1100

Remove the event.preventDefault Function from your HTML line. Because, This will prevent your events.

<a onclick="window.parent.postMessage('link_url:'+this.href,'*');" href="?redirect=Pro" class="btn btn-accept display-5" target="_blank">I AGREE</a>

Upvotes: 2

Related Questions