Skip to content

Instantly share code, notes, and snippets.

@haruair
Created April 18, 2014 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haruair/11046710 to your computer and use it in GitHub Desktop.
Save haruair/11046710 to your computer and use it in GitHub Desktop.
Daum map API v3 with DOM
(function (e, d) {
if (typeof d == "object") {
for (var f in d) {
if (d.hasOwnProperty(f)) {
e[f] = e[f] || d[f], arguments.callee(e[f], d[f]);
}
}
}
})(this, {
daum: {
maps: {
VERSION: {
ROADMAP: "211111rest",
HYBRID: "211111rest",
ROADVIEW: "1.00",
ROADVIEW_FLASH: "140417",
ROADVIEW_AJAX: "140414"
}
}
}
});
var s, fs;
s = document.createElement('script');
s.type = 'text/javascript';
s.src = (location.protocol == "https:" ? "https:" : "http:") + '//apis.daum.net/maps/real/maps3.65.js';
fs = document.getElementsByTagName('script')[0];
fs.parentNode.insertBefore(s, fs);
@haruair
Copy link
Author

haruair commented Apr 18, 2014

원래 코드는 document.write로 작성되어 있어서 meteorjs 등과 같이 비동기적으로 외부 스크립트를 불러오는 경우에 문제가 발생하고 있습니다. 서비스 개선에 도움이 되었으면 합니다.

var protocol = (location.protocol == "https:" ? "https:" : "http:");
document.write('<script type="text/javascript" src="' + protocol + '//apis.daum.net/maps/real/maps3.65.js" charset="utf-8"><\/script>');

@ssegin
Copy link

ssegin commented May 28, 2015

감사합니다 덕분에 고민하던 문제가 해결되었습니다. 그런데 사용하려다 보니 제가 발급받은 api키를 넣는 곳이 없는데 문제되는 일이 없는지 궁금합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment