473,769 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

popup refresh question

Hi.

I have a page that contains this simple function:

<script language="javas cript">
function openPop(url, name, w, h) {
var features = "";
features += "scrollbars=no, ";
features += "menubar=no ,";
features += "resizable=no," ;
features += "left="+Math.fl oor(screen.widt h/2-w/2)+",";
features += "top="+Math.flo or(screen.heigh t/2-h/2)+",";
features += "alwaysRaised=n o,";
features += "width=" + w + ",";
features += "height=" + h;
nw = window.open(url , name, features);
}
</script>

Il opens a popup.htm using this system:
popup.htm?artis t=picasso&type= maxi&nImg=3.jpg &w=499&h=300 ;

When the popup opens (it only contains an image!), it reads this url,
looks for the data and loads it into the window:

<script language='javas cript'>

var qst=location.se arch.substr(1);
var dati = new Array()
dataInUrl=qst.s plit("&");
// artist name
var d1 = dataInUrl[0].substr(dataInU rl[0].indexOf("=")+1 );
// folder type
var d2 = dataInUrl[1].substr(dataInU rl[1].indexOf("=")+1 );
// image path
var d3 = dataInUrl[2].substr(dataInU rl[2].indexOf("=")+1 );
// width
var d4 = dataInUrl[3].substr(dataInU rl[3].indexOf("=")+1 );
// height
var d5 = dataInUrl[4].substr(dataInU rl[4].indexOf("=")+1 );
</script>

</HEAD>
<BODY bgcolor="#00000 0" topmargin="0"
marginheight="0 " leftmargin="0" marginwidth="0" >

<script language='javas cript'>
document.write( "<img src='" + path + "' border=0 height='"+d5+"'
width='"+d4+"'> " );
</script>

Everything gets loaded when wanted but:
1) the first image perfectly adheres to the border of the popup
2) when I call again the function (setting other dimensions for the
popup) I get the same dimensions as the first time I loaded the popup:
that is, if the first time I called a 300x300 popup and the second time
I specified a width of 450x340, I get again a popup 300x300 window (but
containing the right content!).

Is there any way to have the things working as I imagined? :-)

Thanks in advance,
ypress
Oct 14 '05 #1
3 1992

ypress wrote:
Hi.
Everything gets loaded when wanted but:
1) the first image perfectly adheres to the border of the popup
2) when I call again the function (setting other dimensions for the
popup) I get the same dimensions as the first time I loaded the popup:
that is, if the first time I called a 300x300 popup and the second time
I specified a width of 450x340, I get again a popup 300x300 window (but
containing the right content!).

Is there any way to have the things working as I imagined? :-)


Send the popup the width and height you want instead (URL params), then
use the resizeTo function.
Note that some browsers give the users the ability to turn that off,
but for the most part, if someone has popups enabled, they probably
allow resizing.
Those of us who use tabbed browsers and redirect to tabs (not a new
window) turn it off so it doesn't screw up all our other open tabs.

HTH

Oct 14 '05 #2
ypress wrote :
Hi.

I have a page that contains this simple function:

<script language="javas cript">
Language is deprecated; type has replaced language and is both backward
and forward-compatible.
function openPop(url, name, w, h) {
var features = "";
features += "scrollbars=no, ";
Turning off scrollbar(s) in case content overflows requested window
dimensions is counter-usability; you are deliberately removing from the
user the ability to reach and access content in case such content is
clipped from the window view. What you are trying to do goes explicitly
against accessibility common sense and default usability fallback in
browsers.
The normal attitude should be to allow such window to render
scrollbar(s) if content overflows window dimensions.
features += "menubar=no ,";
As soon as the WindowFeatures string list is not empty, all of the
configurable features are turn off. So, what you do here is useless.
features += "resizable=no," ;
Same thing here. You are deliberately removing the user ability to
resize the window in case *your* imposed window dimensions clip the
content from the window view. What you do goes explicitly against
accessibility common sense.
The normal, sane fallback mechanism should be to allow such window to be
resizable.
features += "left="+Math.fl oor(screen.widt h/2-w/2)+",";
features += "top="+Math.flo or(screen.heigh t/2-h/2)+",";
Your calculations do not take into consideration the available
dimensions for applications. So this is wrong. You are miscalculating
the real available workarea for applications on the user's screen.
features += "alwaysRaised=n o,";
features += "width=" + w + ",";
features += "height=" + h;
So far, your script concatenates 9 times a bunch of sub-strings and we
know that string concatenation is time consuming and resources (memory
management) consuming. E.g.:

var strExample = "";
strExample += "abc";
strExample += "def";
strExample += "ghi";
strExample += "jkl";
will be 4 times slower and resources-demanding than
var strExample = "abc" + "def" + "ghi" + "jkl";
nw = window.open(url , name, features);
}
</script>

Il opens a popup.htm using this system:
popup.htm?artis t=picasso&type= maxi&nImg=3.jpg &w=499&h=300 ;

When the popup opens (it only contains an image!), it reads this url,
looks for the data and loads it into the window:

<script language='javas cript'>
Language is deprecated; type has replaced language and is both backward
and forward-compatible.

var qst=location.se arch.substr(1);
var dati = new Array()
dataInUrl=qst.s plit("&");
// artist name
var d1 = dataInUrl[0].substr(dataInU rl[0].indexOf("=")+1 );
// folder type
var d2 = dataInUrl[1].substr(dataInU rl[1].indexOf("=")+1 );
// image path
var d3 = dataInUrl[2].substr(dataInU rl[2].indexOf("=")+1 );
// width
var d4 = dataInUrl[3].substr(dataInU rl[3].indexOf("=")+1 );
// height
var d5 = dataInUrl[4].substr(dataInU rl[4].indexOf("=")+1 );
</script>

</HEAD>
<BODY bgcolor="#00000 0" topmargin="0"
marginheight="0 " leftmargin="0" marginwidth="0" >
If you want to remove margin on the body node, then using CSS is much
preferable than to use invalid markup code.

<script language='javas cript'>
document.write( "<img src='" + path + "' border=0 height='"+d5+"'
width='"+d4+"'> " );
</script>

Everything gets loaded when wanted but:
1) the first image perfectly adheres to the border of the popup
In which browser? which browser version? What is the code of your call
function?
Are you actually saying that your image should not adhere to the border
of the popup window? Is that what you are trying to say? It isn't clear
since it seems to me that you want windows to have 0 margins.
2) when I call again the function (setting other dimensions for the
popup) I get the same dimensions as the first time I loaded the popup:
that is, if the first time I called a 300x300 popup and the second time
I specified a width of 450x340, I get again a popup 300x300 window (but
containing the right content!).
This dimensions problem would be a lot less annoying and frustrating for
the user if you had defined resizable=yes and scrollbars=yes in the
window.open() call to begin with.

Is there any way to have the things working as I imagined? :-)

Yes. Your problem is not difficult to fix. For which browsers you want
this to work? Can you provide an url for where your code, all your code
is? Without seeing how you make the function call in the opener page,
it's not possible to be sure.

Gérard
--
remove blah to email me
Oct 14 '05 #3
nikki wrote :
Send the popup the width and height you want instead (URL params), then
use the resizeTo function.
Note that some browsers give the users the ability to turn that off,
but for the most part, if someone has popups enabled, they probably
allow resizing.


I'd say the exact opposite. Most people disallow unrequested popups,
allow requested popups but will disable the ability of script to resize
as they wish, just like that, existing windows. Moving and resizing
windows has been abused so much before that people won't let this happen
again.

Gérard
--
remove blah to email me
Oct 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2036
by: Logger | last post by:
Help, Want someone's option. I'm calling a popup screen, say form B, to add/edit a record. In, say form A, I call form B using javascript window.open in server side code. I need to know when I come back to form A so I can refresh the screen from the database if a record was added or the data changed that I'm displaying. My question is: What is the best way to figure out when form b finishes and return to form A so that I can run this...
4
3175
by: Andrew Alger | last post by:
ok i have two forms. Customer.aspx and Parent_Searh.aspx. There is a button on Customer.aspx that when executed runs javascript code to open up parent_search as a popup. After the user searches for the parent and finds the proper parent in the datagrid they then click on the accept button in the grid. Then I populate a session variable with the parent ID. I then go back to the main page and have it refresh using: ...
3
4792
by: MEM | last post by:
Hello, I'd like to refresh the main or top most browser window from a child window. Specifically, child popup A is opened by a main browser window then child popup B is opened from within child popup A. How do i refer to the very first parent window? Visual...
2
1763
by: rmorvay | last post by:
Do to the complexities of the amount of data that I have in a single record for a datagrid, I allow users to click a datagrid row and it spawns another browser page to allow edits to the data in that row. Once they update the data, it is committed to the database and the form is closed. I need to refresh the calling page by triggering the Search button's event in order to refresh the page properly with the updated info and utilizing the...
3
1919
by: Tulga Kalayci | last post by:
Hi All, I need advise on how to proceed in a area which I have no experience. The problem is related to a call center solution. When a call comes, call center software + server handles call and redirects it to first avaliable agent. No problem here. But I also want to popup a screen on this agent's computer with related data. Now, how should I proceed ? How can a server popup a web page on a client's screen. Should I listen a port on...
2
1348
by: sri | last post by:
hi All: This is the situaton.. I have a treeview with nodes in an aspx page. The node data is coming from DB. when i select a node and click add button, a pop up screen is ahown where the user enters childnode information. the pop up has a save button and when the user clicks save, the data gets saved in DB. Popup also has a close button, clicking which closes the screen.. My Problem: When i close the popup, how can i refresh the tree...
1
1826
by: Rob Petersen | last post by:
I have a datagrid with an Edit/Update column. Instead of editing records "in place" I'd like to do so in a separate popup window because there is a lot of validation, business rules and dynamic controls. What is the best way to launch a popup window (preferably modal) and then refresh the parent datagrid if the user presses a "Save and Close" button in the popup? Are there any caveats regarding popup security or updating a parent grid...
3
3581
by: Opa | last post by:
Hi , I have a form with javasript which launches a popup via the showModalDialog() method. I get the dialog to open, now I am trying to first get a reference to the calling form from the popup and then do a refresh of the calling form. Any ideas on how to get a reference to the calling form? I tried window.parent.location.reload() , but it doesn't work. Thanks a lot.
0
1274
by: NewJavaBee | last post by:
please guide me. i have the following problem: i have a parent window that has a dropdown that is showing names and which is getting its value from a table.table conatins two columns, one is Name and other is Release. there is a button called AddNew which is used to add new Name and release in table. on clicking the button a popup window opens that has two textbox for Name and Release. on clicking the submit button new jsp page is...
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8879
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.