Share Your Work

assi
Guide

Auto redirect to developer mode

In page-editing page, Developer mode is released, and I wanted to use this mode as default, so I made simple scripts. 

 

  1. Install Custom JavaScript for Websites 2 to your Chrome.
  2. Set this RegExp: 
    https://app.hubspot.com/content/\d+/edit/\d+/content​
  3. Paste this JavaScript code: (couldn' use early return 😢)
    if (
      location.href.slice(-1) !== '?'  // "Exit developer mode" button leave '?' at the end of URL.
      && !/developerMode=true/g.test(location.search)
    ) {
      const query = location.search ? location.search + '&developerMode=true' : '?developerMode=true'
      location.href = location.href + query
    }​
  4. Click Save.

cjsのコピー.png

Now you'll be automatically redirect to developer mode.

2 Replies 2
Khanzain
Participant

Auto redirect to developer mode

To automatically redirect to developer mode in HubSpot page editing, you can use the following JavaScript code. This code will check if the current URL does not already have the developerMode parameter set to true, and if not, it will append the parameter to the URL and redirect the user to the updated URL.

Here's the JavaScript code:

 

if (
  location.href.slice(-1) !== '?'  // "Exit developer mode" button leaves '?' at the end of URL.
  && !/developerMode=true/g.test(location.search)
) {
  const query = location.search ? location.search + '&developerMode=true' : '?developerMode=true';
  location.href = location.href + query;
}

 


To set this up:

1. Install the "Custom JavaScript for Websites 2" extension in your Chrome browser.
2. Set the extension to run on URLs matching the following RegExp pattern: `https://app.hubspot.com/content/\d+/edit/\d+/content`
3. Paste the JavaScript code into the extension and save it.
4. When you visit a HubSpot page editing URL that matches the pattern, the extension will automatically redirect you to developer mode.

This will allow you to use developer mode as the default mode for editing pages in HubSpot.
Here are some great places to learn in-depth understanding: 1. W3 School 2. Iqra Technology
3. JavaPoint

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Auto redirect to developer mode

Brilliant! Thank you for sharing, @assi 🙌 — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot