iframe쓰는 게 제일 쉬울 듯...
jquery를 쓰신다면 대충 이런 정도의 코드로 가능할 듯 합니다:
$('a[ref=external]).click(function(e) {
e.preventDefault();
var iframe = $('<iframe>')
.addClass('popup')
.attr(src, $(this).attr('href'))
.appendTo(document.body);
$('<button>')
.addClass('popupclose')
.html('Close')
.click(function() { $(iframe).remove(); })
.appendTo(document.body);
$('<button>')
.addClass('popupbrowser')
.html('Browser')
.click(function() { ax.ext.ui.open($(e.target).attr('href')); });
.appendTo(document.body);
}
css는 적절하게 꾸며주시면 되구요...
iframe.popup {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
...
}
button.popupclose {
...
}
button.popupbrowser {
...
}
다만, twitter나 facebook 등의 oauth 페이지들은 iframe안에서 열리지 않으므로(피싱 방지를 위한 헤더)...
child browser 플러그인을 쓰셔야 겠지요.
앱스프레소의 경우에는 ax.ext.ui.addWebView/removeWebView 함수를 사용하시면 되는데요,
안타깝게도 앱스프로레소 현재버전(1.0RC2)버전의 경우 ios만 지원합니다.
정식버전에는 android/ios 둘 다 지원할 수 있을 듯...^^;
이 경우에도 위에 코드와 비슷한데요...
iframe 태그 만드는 코드와 그 태그 지우는 코드를 위의 함수로 대체하면 됩니다.
$('a[ref=external]).click(function(e) {
e.preventDefault();
var child;
ax.ext.ui.addWebView(
function(result) { child=handle; },
$(this).attr('href')),
{ top:0, left:0, width:320, height:480 });
$('<button>')
.addClass('popupclose')
.html('Close')
.click(function() { ax.ext.ui.removeWebView(function() { }, child); })
.appendTo(document.body);
$('<button>')
.addClass('popupbrowser')
.html('Browser')
.click(function() { ax.ext.ui.open($(e.target).attr('href')); });
.appendTo(document.body);
}
위의 코드는 디테일한 에러 처리등을 생략한 코드인데요...
조만간 위의 코드를 간단한 예제 앱으로 만들어서 올려볼께요~