Last active
August 29, 2015 14:06
-
-
Save neil-s/873a5c2bbe7e578048fa to your computer and use it in GitHub Desktop.
This is the faulty code trying to secure the doorbell widget.
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
window.doorbellOptions = { | |
appKey: MY_APP_KEY | |
}; | |
jQuery.ajax({ | |
url: "/get-doorbell-secret/", | |
success: function (data) { | |
$.each(data, function (key, val){ | |
window.doorbellOptions[key] = val | |
}) | |
}, | |
async: false | |
}); | |
(function(d, t) { | |
var g = d.createElement(t);g.id = 'doorbellScript';g.type = 'text/javascript';g.async = true;g.src = 'https://doorbell.io/button/362';(d.getElementsByTagName('head')[0]||d.getElementsByTagName('body')[0]).appendChild(g); | |
}(document, 'script')); |
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
window.doorbellOptions = { | |
appKey: MY_APP_KEY | |
}; | |
(function(d, t) { | |
var g = d.createElement(t);g.id = 'doorbellScript';g.type = 'text/javascript';g.async = true;g.src = 'https://doorbell.io/button/362';(d.getElementsByTagName('head')[0]||d.getElementsByTagName('body')[0]).appendChild(g); | |
}(document, 'script')); | |
$.getJSON("/get-doorbell-secret/", function (data) { | |
$.each(data, function(key, val){ | |
window.doorbell.setOption(key,val) | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also tried shuffling the order around, such as setting the options before the function that writes the HTML, and even simply pushing the values into the doorbellOptions array before the function.