Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Adobe script is overriding the event.preventDefault()

Avatar

Avatar
Level 1
dnaveenkumar
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
dnaveenkumar
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
dnaveenkumar
Level 1

03-03-2021

Hi,

On anchor tag click function we use event.preventDefault() to prevent the link from opening. This was working fine so far. Recently, we migrated from DTM to Launch and from then the preventDefault method is not working.

In the below sample when we click on the "test page" link it should not change the URL. But it is changing the URL to "#testpage". In the same page please remove the adobe script and run. It won't change the URL.

Sample Page code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a href="#testpage" onclick="gototest(event)">test page</a>
    <script>
        function gototest(e){
            e.preventDefault();
        }
    </script>
    <script type="text/javascript">_satellite.pageBottom();</script>
</body>
</html>

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Contributor
Employee
thebenrobb
Employee

Likes

145 likes

Total Posts

318 posts

Correct Reply

83 solutions
Top badges earned
Contributor
Seeker
Shape 1
Give Back 3
Give Back
View profile

Avatar
Contributor
Employee
thebenrobb
Employee

Likes

145 likes

Total Posts

318 posts

Correct Reply

83 solutions
Top badges earned
Contributor
Seeker
Shape 1
Give Back 3
Give Back
View profile
thebenrobb
Employee

04-03-2021

I recommend you take a look at the Link Delay explainer.

The Click event from the Core extension uses this behavior when it is configured with the link delay option on.  My guess is that you've got a Click Event with link delay turned on, and the selector in that event is selecting this link and doing what link delay is designed to do.  You can turn off the link delay or refine the selector in that click event so that it doesn't trigger on this link.