Created
November 5, 2013 11:55
-
-
Save romaricdrigon/7317993 to your computer and use it in GitHub Desktop.
Symfony2 DebugToolbar Bookmarklet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var e=window.location.href.match(/.+\/app_dev\.php/);if(e){var t=new XMLHttpRequest;t.open("GET",document.location,false);t.send(null);var n=t.getResponseHeader("X-Debug-Token");var r=e[0]+"/_profiler/"+n;window.location.href=r}})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For a given Symfony2 app page, being in DEV mode (app_dev.php), | |
Open (or redirect) to the corresponding web debug profiler | |
*/ | |
javascript:(function() { | |
// Get base url | |
var url = window.location.href.match(/.+\/app_dev\.php/); | |
if (url) { | |
// We can't directly get headers - we have to make a new request to get them | |
var req = new XMLHttpRequest(); | |
req.open('GET', document.location, false); | |
req.send(null); | |
var token = req.getResponseHeader('X-Debug-Token'); | |
var debugUrl = url[0] + '/_profiler/' + token; | |
// uncomment to open a pop-up | |
//window.open(debugUrl); | |
// or redirect | |
window.location.href = debugUrl; | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment