주소 고정 시킨 후
본문
<html>
<head>
<title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<frameset cols="0,100%" border="0">
<frame>
<frame src="http://www.도메인.co.kr/index.php"> //------> 자신의 보드에 위치한 index.php
</noframes>
</frameset>
</html>
위 소스를 사용해서 주소를 고정시켰더니...다른 페이지에서 F5를 실행하면 초기화면으로 돌아갑니다.
돌아기지 않게 하는 방법이 있으면 알려주시면 감사하겠습니다.
답변 2
<frame 태그를 쓰면 원래 그렇습니다.
url 바뀌는걸 막으려고 하신거니까 그렇죠.
매번 페이지 바뀔때마다 현재 URL을 세션이나 쿠키로 구우시고 새로고침 할때마다 그 페이지를 연결하시는 방법이 있을듯 한데 시도해본건 아닌데 여하튼 어려운 문제인것 같아요.
경우에 따른 변수가 있지만. 단순 F5 키 또는 컨트롤+R 정도는
꼭 쿠키나 세션이 필요하진 않습니다. 스크립트로 제어 가능합니다.
frameset 에 새로고침할 함수를 하나만들어 줍니다. 새로고침될 프레임의 url 을 받아서 다시 넣어주는 내용
frame 에는 F5 키자체를 막아버리고, 상위 frameset 의 함수를 호출하면서 현재 frame 의 url 정보를 같이 던저 줍니다.
-framset.html-
<html>
<head>
<title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
function set(url){
document.getElementById('test').src='url';
}
</script>
</head>
<frameset cols="0,100%" border="0">
<frame>
<frame id="test" src="frame.html">
</noframes>
</frameset>
</html>
-frame.html-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); };
$(document).ready(function(){
$(document).on("keydown", disableF5);
window.top.set(document.location.href);
});
</script>
답변을 작성하시기 전에 로그인 해주세요.