I need to capture the values for screen height and screen width and assign them PHP variable names ($width, $height) without reloading or submitting the page. Can I do this?
Nope. The screen height and width are only available to JavaScript (which runs on the browser), and the only way to get the data to PHP (which runs on the server) is to submit data to the server.
could you create a page with an iframe taking up all but a pixel border, use the framing page to pick up h and w via javascript and then call the real page inside the iframe using javascript with necessary parameters in the url?
this way there won't be a reload but it will delay the primary load a bit.
My earlier post said, you might be able to send the browser and intermediate page with an HTML form and some JavaScript which fills in the blanks and automatically submits the form. The data gets back to PHP, which records it, perhaps in a session variable, then sends the browser to the "real" page.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.