|
Exit
May 7, 2008 9:15:50 GMT -5
Post by kokenge on May 7, 2008 9:15:50 GMT -5
I'm trying to develop a general [Exit] routine. I need to know if a program is opened in a new window (tab), or opened in the same window. If it's opened in a new window, I want to close it (window.close) on Exit. If opened in the same window I want to go back to the calling URL on Exit.
I think if I could find the Javascript history.list value and the history.previous URL on program entry, and hold that stuff, I could use that information on Exit. But donno!!
Thanks for the help...
|
|
|
Exit
May 7, 2008 9:36:13 GMT -5
Post by carlgundel on May 7, 2008 9:36:13 GMT -5
You could try saving some shared state in a database table. Then run different programs that communicate with each other that way.
-Carl
|
|
|
Exit
May 7, 2008 10:10:00 GMT -5
Post by kokenge on May 7, 2008 10:10:00 GMT -5
My problem is, I developed a couple RB programs that I've allowed anyone to use. How they link to the programs I donno? So it has to be a general Exit. Basically the program has to know if it was linked to in a new window or the same window. Then Exit knowing that information.
Thanks for the help....
|
|
|
Exit
May 7, 2008 10:56:48 GMT -5
Post by carlgundel on May 7, 2008 10:56:48 GMT -5
Okay. I don't understand what you're saying.
Linking to a program on your site is simple. Just tell them to:
1) Link to an HTML page on your site that redirects them to your app.
or 2) Give them a complete URL including the app tag
Or do you mean that if someone uses your program, that your programs needs to know how to go back to the page on someone else site that it was linked from? Why? I don't think people expect a site they visit to automatically take them back to the referring site. Or do I misunderstand?
-Carl
|
|
|
Exit
May 7, 2008 12:52:12 GMT -5
Post by kokenge on May 7, 2008 12:52:12 GMT -5
Maybe a example will help. I have a package that companies want. Some stuff is sensitive and company policy dictates that all programs will run in house. They have a home page. It allows them to run various projects. To run the RB stuff they must buy RunBasic. Users sign on to the home page. If they have privileges the home page will allow them to link to the RB project in a new window or a sub window. From past experience, most will open it in a sub-window. When they click the Exit button it must return to it's home page. However if the home page linkes to the RB software in a new page, when they click the exit button, it will close the window. When it closes it returns to the tab that called it. If they Exit in a sub window, it must return to the previous URL without closing the window. So Exit looks the same regardless of how it got there.
Basically, Exit on a new window closes it and returns to the tab that called it, and Exit on a sub window goes back to the previous URL without closing. I just need to know how to do it??
Thanks for the help..
|
|
|
Exit
May 7, 2008 18:19:30 GMT -5
Post by StefanPendl on May 7, 2008 18:19:30 GMT -5
There is no difference if the new page is opened in a tab or a new window, you will always use window.close You do not have control over the way a user will set his browser preferences and it is a security hole to allow web applications to know how they are currently displayed.
|
|
|
Exit
May 7, 2008 19:19:54 GMT -5
Post by kokenge on May 7, 2008 19:19:54 GMT -5
Here is RB code using the window.close
print "Exit back to Home Page" link #e, "Exit",[doExit] wait
[doExit] html "<script language='javascript' type='text/javascript'> window.open('','_parent',''); window.close(); </script>" end
If the URL that linked to it opened it in a new window or tab, when you click [Exit], it closes the window and goes back to the home page. The home page opens a new window
<A HREF="http://www.dkokenge.com:8008/seaside/go/runbasicpersonal?app=aaa" target="_blank">Test Exit in new window</A>
However if you open the RB program in the same page it will NOT return to the home Page Home page opens in same window
<A HREF="http://www.dkokenge.com:8008/seaside/go/runbasicpersonal?app=aaa">Test Exit in same window</A></TD>
I need the EXIT in RB to return to the home page regardless if it is in a new window or not.
Thanks for the help.
|
|
|
Exit
May 7, 2008 21:03:36 GMT -5
Post by kokenge on May 7, 2008 21:03:36 GMT -5
Ok! This Exit routine seems to work.
If you open this RB program in a new window, it closes the window and goes back to the home page.
If you open it in the same window, it also goes back to the home page.
print "Exit Back to home Page" link #t, "Test",[doTest] print link #e, "Exit",[doExit] print wait [doTest] print "Hello" wait
[doExit] html "<script language='javascript' type='text/javascript'> var a = history.length; a = a - 1; window.open('','_parent',''); window.close(); history.go(-a); </script>" end
Thanks for the help.
|
|