Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Warren
Warren

Posted on

     

Ajax'd Javascript in dev tools

Honestly I'm mostly writing this as a note to my self since I have learnt about and then forgotten this particular trick several times over the last few years.

If you're loading javascript through ajax (quite common when working with ASP.NET MVC) then you can give a hint to the browser which enables it to open it in the dev tools with a specific file name. Just add//# sourceURL=filename.js before the closing</script> tag.

e.g.

<script>$(function(){console.log("wibble")})//# sourceURL=wibble.js</script>

From the browser's dev tools you should now be able to open this file by searching for "wibble.js" (Ctrl+P brings up the search)

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
dowenb profile image
Ben Dowen
I'm a quality hero, customer champion. Experienced software tester and newbie developer.Okay, so I've actually been dabbling in code for a long time. I've just not gone very deep in any language .
  • Email
  • Location
    UK
  • Education
    BSc Forensic and Security Technology
  • Work
    Quality Engineer, Ada Health
  • Joined

Nice trick thanks for sharing.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Work
    Software Engineer
  • Joined

More fromWarren

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp