Script crashes on invalid URL hashes

Created on 19 December 2024, about 1 month ago

Problem/Motivation

We're in the process of integrating an external CRM which uses URL hashes to communicate with its scripts and provide additional information. Unfortunately these hashes come in the form of something like #param1=value1&param2=value2, which is an invalid document ID. That itself is not a problem, the problem is that calling $(window.location.hash) with this ID throws an uncaught error.

My intention is to fix this by catching this specific error when it occurs.

Steps to reproduce

  1. Start with website with Auto Anchors installed
  2. Visit URL on site
  3. Append #param1=value1&param2=value2 to end of URL

Proposed resolution

Catch this specific error when trying to instantiate the jQuery object.

Remaining tasks

Implement the change as a patch.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇦🇺Australia geoffreyr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024