hi to all
i am using jquery and php.
i want to open iFrame when i change product id in browser url.
can any one help me "how to get id from browser window even i manually change the produt id ".
and open iFrame.
Thanks
hi to all
i am using jquery and php.
i want to open iFrame when i change product id in browser url.
can any one help me "how to get id from browser window even i manually change the produt id ".
and open iFrame.
Thanks
Maybe something like this? You'd need to change the appURL and queryParameterName to reflect your own configuration.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>iFrameLoader</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
.none { display: none; }
.block { display: block; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var appURL = 'http://digg.com';
var queryParameterName = 'product_id';
$(document).ready(function() {
checkQueryString(queryParameterName);
});
function checkQueryString(paramName) {
var paramValue = gup(paramName);
if (paramValue != null) {
$('#content-iframe').attr('src', appURL + '?' + paramName + '=' + paramValue);
$('#content-iframe').removeClass('none');
$('#content-iframe').addClass('block');
}
}
function gup(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if (results == null) return "";
else return results[1];
}
</script>
</head>
<body>
<h1>Somewhere here would be content.</h1>
<iframe id="content-iframe" class="none"></iframe>
</body>
</html>