Collecting JS generated values

1 view
Skip to first unread message

Gudgee

unread,
Apr 26, 2006, 10:33:57 AM4/26/06
to miva-script
I am looking for a way to use Miva to store the values for screen
resolutions which are captured by a JS routine.

The bit of JS in question is as follows;

else if (screen.width <= 800) {
document.location = "swap.html?+res+800";

Anybody know how can I persuade Miva to grab the 'screen.width'
variable and write it to a file?

Claudiu Bischoff

unread,
Apr 26, 2006, 11:16:32 AM4/26/06
to miva-...@googlegroups.com
Hi,

If your problem is only to store the values here is a cool and simple way to
do it (without making redirection):

<script type="text/javascript" language="JavaScript">
var width=screen.width;
var height= screen.height;
var
url="http://your-domain-name.com/mivascript.mvc?width="+width+"&height="+hei
ght;
document.write('<scr' + 'ipt src="' +url+ '&var2=1"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
</SCRIPT>

Just put this script to the end of your file and create a file (in our case
mivascript.mvc), which will grab the "width" and "height" values. Of course,
don't generate any response in that file, else you will have a JavaScript
error.

A better way to do that is to use AJAX (HTTP REQUEST) but it's more
complicated.. Anyway if you need an AJAX example and I'll post it :P

Best regards,
Claudiu Bischoff

> -----Message d'origine-----
> De : miva-...@googlegroups.com [mailto:miva-...@googlegroups.com] De
> la part de Gudgee
> Envoyé : mercredi 26 avril 2006 16:34
> À : miva-script
> Objet : [miva] Collecting JS generated values

Ralph Gauer

unread,
Apr 26, 2006, 11:32:59 AM4/26/06
to miva-...@googlegroups.com
Claudiu,

Very cool....

Best
rg

Ralph Gauer
Interim Executive Director, SIGRED
ralph...@zianet.com
505-590-7739 cell
www.silvercitybusiness.com
www.grantcountybusiness.com

Gudgee

unread,
Apr 26, 2006, 2:50:21 PM4/26/06
to miva-script
Excellent Claudia - many thanks.

I would appreciate a look at the Ajax thingie.

John Tuach

Reply all
Reply to author
Forward
0 new messages