SOLVED

JavaScript in Landing Page Template

Go to solution
Jo_Pitts1
Level 10 - Community Advisor

JavaScript in Landing Page Template

All,

I have a situation where I have some JS written directly into a Landing Page Template.

 

I want to debug said JS.  I'm using Chrome for this.  When I hit F12 and go to sources, I can't find the LPT code anywhere.   I did a 'search all files' and typed in a variable name I know exists in the code, and that turned up nothing.

 

As per usual, I am sure I am being super blind and or super dense.  Any help would be appreciated.

 

Cheers

Jo

1 ACCEPTED SOLUTION

Accepted Solutions
Jo_Pitts1
Level 10 - Community Advisor

Re: JavaScript in Landing Page Template

All,

with @SanfordWhiteman 's help we found a cunning answer.  If you can't get the chrome devtools to surface the code, then put this line of code

debugger;

where you want to debug in your Landing Page Template.  It'll force the chrome devtools to bring this code into view.  From then you can apply other breakpoints and or start stepping through your code.

 

A tiny bit odd, but super handy. 

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: JavaScript in Landing Page Template

Definitely the main doc would be under Sources, and AFAIK can't be black-boxed. What's the URL?

Jo_Pitts1
Level 10 - Community Advisor

Re: JavaScript in Landing Page Template

@SanfordWhiteman , its a template URL so I'm not sure I can expose it to you?

SanfordWhiteman
Level 10 - Community Moderator

Re: JavaScript in Landing Page Template

If you're in the Template preview, the doc would be in an IFRAME.

Jo_Pitts1
Level 10 - Community Advisor

Re: JavaScript in Landing Page Template

I hunted down through the iframes and still couldn't see what I was looking for.

I'm happy to screen share with you if you have time.

Jo_Pitts1
Level 10 - Community Advisor

Re: JavaScript in Landing Page Template

All,

with @SanfordWhiteman 's help we found a cunning answer.  If you can't get the chrome devtools to surface the code, then put this line of code

debugger;

where you want to debug in your Landing Page Template.  It'll force the chrome devtools to bring this code into view.  From then you can apply other breakpoints and or start stepping through your code.

 

A tiny bit odd, but super handy.