Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2010, 03:13 AM
Authorized User
 
Join Date: Jun 2008
Location: Faridabad, Haryana, India.
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Default ScreenSize in JScript

Hi All,

I am using javascript for get screen width and height, Following javascript function i am using:

function test() {
var path = window.location+"?width="+screen.width;
window.location.href(path);
}

On page load event i am using this function with check javascript is enabled or not on page Load Event:

protected void Page_Load(object sender, EventArgs e)
{
if (Session["JSChecked"] == null)
{
Session["JSChecked"] = "Checked";
string path = Request.Url + "?JScript=1";
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "redirect", "window.location.href='" + path + "';", true);
}
if (Request.QueryString["JScript"] == null)
{
Response.Write("JavaScript is desactivated.<br/>Plz Activate JavaScript");
}
else
if (Request.QueryString["JScript"] != null)
{
if (Request.QueryString["width"] == null)
{
Response.Write("JavaScript is activated.<br>Plz wait Loading...");
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "test", "test();", true);
Session["JScript"] = "Enabled";
}
else { Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "test", "test();", true); }
}

if (Session["JScript"] != null)
{
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "test", "test();", true);

Response.Write(Request.QueryString["width"]);
}

Response.Write(Request.QueryString["width"]);


But this is reloading the page. All items are displayed and then they are reloading again.

What is the solution for this reloading the page or get screen size minimum amount of time on page load.

Thanks in advance
__________________

 
Old December 5th, 2010, 08:01 PM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

I think you posted this to the wrong forum. It does not seem to be related to XMPP.

Quote:
Originally Posted by Jitender View Post
But this is reloading the page. All items are displayed and then they are reloading again.

What is the solution for this reloading the page or get screen size minimum amount of time on page load.
If you modify the window.location object, it will force the browser to load a new page.
The Following User Says Thank You to metajack For This Useful Post:
Jitender (December 7th, 2010)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Screensize Mantis Pro JSP 0 February 12th, 2005 07:01 AM
JScript DumAss HTML Code Clinic 1 August 25th, 2004 02:46 AM
PLEASE HELP! ACTIVEX in JScript stalker Javascript 2 August 15th, 2003 05:04 PM
JScript Des67 Javascript 1 July 28th, 2003 05:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.