We’ve rarely used the …
- form
- method=POST
- action=[URLofInterestOfPHP]
- target=_self (versus any “_blank” (we’d have used most often in the past) or “_parent” or “_top” or “framename” (of iframe) alternative target value ideas)
… style of arrangement in the past, but we’ve found it useful recently (a couple of times) because we find we want to, more and more, use …
- hashtagged data
- reassembled into a …
- form
- method=POST
- action=[URLofInterestOfPHP]
- target=_self
… arrangement …
… that way keeping any window.parent and window.self and/or window.opener and window.self connections intact, and at the same time, being able to involve very long (mostly hashtagged data) URLs in the arrangements.
Let’s show you an example. In the recently talked about Google Charts Image Chart Map Chart inhouse interfacer called image_chart.php downaways into the code it now goes …
<?php
$screenheight='0';
<br>
// ;Continent;CC1|CC2|:blLAT,blLONG,trLAT,trLONG:width,height:scblX,scblY,sctrX,sctrY
$continfo=';Europe;IS|CY|:35.16666,-27.6,67.0,33.36666:468,450:422,560,890,140'; // 53 523
$continfo.=';Australia;AU|AU|:-44,113.65,-10.26667,161.28333:600,450:422,560,866,140';
$continfo.=';Asia;FI|WS|:-14,37,81,179.9:600,450:422,560,866,140';
$continfo.=';America;GS|US|:-56,-179.9,77,-35:600,450:422,560,866,140';
$continfo.=';Africa;TF||:-35,-17,37,52:600,450:422,560,890,140';
if (isset($_GET['screenheight'])) {
$screenheight=str_replace('+',' ',urldecode($_GET['screenheight']));
}
if (isset($_POST['screenheight'])) {
$screenheight=str_replace('+',' ',urldecode($_POST['screenheight']));
}
<br>
if (isset($_GET['nothing'])) {
exit;
} else if ($screenheight != '0' && !isset($_GET['returnxytoparent']) && (!isset($_POST['returnxytoparent']) && !isset($_POST['ix']))) {
echo "<html>
<head>
<script type=text/javascript>
function tryit() {
if (('' + location.hash).indexOf('returnxytoparent=') != -1) {
document.getElementById('returnxytoparent').value=decodeURIComponent(('' + location.hash).split('returnxytoparent=')[1].split('&')[0].split('#'));
document.getElementById('submy').click();
}
}
</script>
</head>
<body onload=tryit();>
<form style=display:none; target=_self action=/PHP/GeoChart/image_chart.php method=POST>
<input type=hidden name=returnxytoparent id=returnxytoparent value=\"\"></input>
<input type=hidden name=screenheight value=" . $screenheight . "></input>
<input type=submit style=display:none; value=Submit id=submy></input>
</form>
</body>
</html>";
exit;
} else if (isset($_GET['returnxytoparent']) || (isset($_POST['returnxytoparent']) && !isset($_POST['ix']))) {
// more code to do with real returnxytoparent data follows
}
// more code follows
?>
… called from our inhouse Region Picker in this way now (where inhouse Javascript function windowdotdotopen can be thought of as window.open for these purposes) …
if (eval('' + encodeURIComponent(theurlis).length) > 750) {
dbwo=windowdotdotopen('//www.rjmprogramming.com.au/PHP/GeoChart/image_chart.php' + '?screenheight=' + screen.height + '#returnxytoparent=' + encodeURIComponent(theurlis),'_blank','top=' + eval(-300 + screen.height) + ',left=450,width=600,height=300');
} else {
dbwo=windowdotdotopen('//www.rjmprogramming.com.au/PHP/GeoChart/image_chart.php?returnxytoparent=' + encodeURIComponent(theurlis) + '&screenheight=' + screen.height,'_blank','top=' + eval(-300 + screen.height) + ',left=450,width=600,height=300');
}
… setting up a two way understanding between window.opener Region Picker and window.self Google Charts Image Chart Map Chart inhouse interfacer. Using that target=_self arrangement above allows …
- despite the “double dipping” transfer of hashtagged URL data (when longer than 750 characters, that is) into method=POST form data (of considerable size) …
- that understanding between window.open Region Picker and window.self Google Charts Image Chart Map Chart inhouse interfacer remains intact
Yayyyyyy!
If this was interesting you may be interested in this too.