Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
36
rated 0 times [  40] [ 4]  / answers: 1 / hits: 34087  / 14 Years ago, thu, october 14, 2010, 12:00:00

On my production website, I have compiled Javascript.



<script src=/js/mycode.min.js></script>


It would be very convient for debugging if I could make my browser replace that with



<script src=http://localhost/js/mycode1.js></script>
<script src=http://localhost/js/mycode2.js></script>
...


I know I could manipulate the DOM using something like Greasemonkey userscripts, but I couldn't come up with a solution which would prevent the execution of mycode.min.js.



Any ideas?


More From » debugging

 Answers
11

The way I do it:




  1. Download and install Fiddler if you are on windows.

  2. Enable it to catch http traffic [IE/Chrome does it by default, Firefox - enable it through the add on it installs]

  3. Load up the page in question.

  4. Find the file you want to replace in the http traffic list on the left and click on it.

  5. On the right there is an AutoResponder tab. click on it.

  6. Click on the checkbox to enable automatic responses

  7. Click Add.. button

  8. The 2nd dropdown on right, choose the option that says find a file

  9. Locate the file in the dialog and click save

  10. Repeat steps 4-9 until you replace all the files you want to replace

  11. Refresh the browser window and your new js files are running



Instead of replacing the js file, you can replace the html file and change the js links on the page.



You can install Charles if you are on a mac/linux. (not free, has trial) Steps are similar, but not the same.



If you are using Google Closure to compress files, you can install their plug-in to do the source mapping.


[#95321] Tuesday, October 12, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kieraelsies

Total Points: 718
Total Questions: 103
Total Answers: 104

Location: England
Member since Sun, May 21, 2023
1 Year ago
kieraelsies questions
Tue, Aug 3, 21, 00:00, 3 Years ago
Tue, Feb 23, 21, 00:00, 3 Years ago
Thu, Nov 12, 20, 00:00, 4 Years ago
Wed, Sep 9, 20, 00:00, 4 Years ago
Mon, Sep 16, 19, 00:00, 5 Years ago
;