Link to home
Start Free TrialLog in
Avatar of bfuchs
bfuchsFlag for United States of America

asked on

Debugging JS production code

Hi Experts,

Two questions...

1- Is there a way to temporary change the JavaScript code of a production site for testing without affecting the site itself by other users?
2- I have a link that when double clicking on that it keeps spinning, but when I copy/paste the URL in the navigation pane it works, how can I troubleshoot that?

Thanks
Avatar of lenamtl
lenamtl
Flag of Canada image

Hi,

using chrome right-click inspect and check into the console for error.
if you change the code it will have consequence for all users except if you load script per user role so let say you have debug user role and only run some script for this user this won't affect other user .
This will require some server side code to check the user role and load the JS script for only that user.
If you don't have session & role then you will need to duplicate the page mypage_temp.html and do you tests on this page only.
Avatar of bfuchs

ASKER

@lenamtl,
using chrome right-click inspect and check into the console for error.
Are you referring to #2?
If yes, the problem is that I cannot click on anything as everything keeps flashing including the debug window.
if you change the code it will have consequence for all users...
I had a consultant that claims he was able to test some test code he wrote against my production site, wondering how is that possible...?
Thanks,
Ben
Yes, so using chrome inspect you can see if there are errors into the console.
This help to find what is the related code and which file and line of code that have error, plus the type of error.
You can also run code from the console.
When developing we often console.log the result this is a way to display the values.

Note using the console, if you edit the code let's say you run a script or change a color it won't be saved and it will be done only on your browser for tests / debug purpose.
As soon as you relod the page you will loose the changes into the console.

It is a good idea to keep the console open during the tests

Note if this is flashing, right click / inspect then go to source tab and click on Pause script execution.
This is located at the right of the console
That will stop / pause the Javascript script

Most of browser have a console and code may work ok in some browser version and not from other version.
It is a good idea to know the browser name and version when you have an issue so you can try to reproduce the error in other browsers and /or  version.
Avatar of bfuchs

ASKER

@lenamtl,
Note if this is flashing, right click / inspect then go to source tab and click on Pause script execution.
Did that but dont see anything wrong with the code.

Perhaps you can suggest a way to record my screen so you have an idea whats going on here (e/t keeps jumping, difficult to explain...)?

Thanks,
Ben
Hi, when you pause the script does it stop the jump / flash effect?
There is no error into the console tab?

do this test go to the page right click inspect  / check into console tab (without pausing the script) is there any errors?

Do you have live link so I can check?
Avatar of bfuchs

ASKER

Hi lenamtl,
I have been trying yesterday and today to reproduce this issue and couldn't.
Lets wait another day or two till this happens again, will send you a link.
Thanks,
Ben
SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Hi,

check in the debugger console, we can change all links background color
Right, but that is only for style and color, what about changing embedded JS code?

Thanks,
Ben
Right, but that is only for style and color, what about changing embedded JS code?

we don't change anything

he was able to test some test code

we run/test new code
A good episode for global learning  : https://www.youtube.com/watch?v=H0XScE08hy8

If your really want to test your code on your prod website you can use :
https://developers.google.com/web/tools/chrome-devtools/workspaces
check the first 2min here too : https://www.youtube.com/watch?v=D1pV7ermy6w
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Thanks Experts!