Created
May 19, 2011 05:52
-
-
Save maxim75/980269 to your computer and use it in GitHub Desktop.
Loading disqus on page load
This file contains 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
<html> | |
<head> | |
<title>A</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<button id="test">Test</button> | |
<div style="float: left"> | |
<div id="disqus_thread"></div> | |
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a> | |
<script> | |
var disqus_shortname = 'geolocation'; | |
var disqus_identifier = 'P@4d9bdc05878656142e001bb5'; | |
var disqus_url = window.location; | |
var disqus_developer = 1; | |
var disqus_title = "sss"; | |
</script> | |
</div> | |
<script> | |
console.log("start load"); | |
$("#test").click(function() { | |
console.log("start"); | |
var dsq = document.createElement('script'); | |
dsq.type = 'text/javascript'; | |
dsq.async = true; | |
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; //?pname=wordpress&pver=2.61 | |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | |
console.log("end"); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment