opening a window in a target frame - java

I have a website and ran into an issue.
First of all the website is in dutch however the problem i have you don't have to understand dutch.
My website is www.hobbysite.zz.mu/
When you click the login button it redirects you to a mybb forum login (this is correct)
next part is the tricky part for me.
when you click the login button there it should run this script:
<html> <head>
<script language="Javascript">
function trigger(){
document.php-form.submit();
document.htm-form.submit(); }
</script> </head>
<body onload="trigger();">
<form name="php-form" action="http://hobbysite.zz.mu/top.html" target="_topframe">
<form name="htm-form" action="http://hobbysite.zz.mu/Main/main.html" target="mainframe">
</body>
Problem is however that its not doing the first option and chance the "cloud" set.
my first cloudset iswww.hobbysite.zz.mu/top1.html and it should chance in the target frame topframe to hobbysite.zz.mu/top.html
thanks in advance

Instead of trying to submit two forms you could change the location of the frames. Try this code:
<html><head>
<script>
function trigger() {
top.frames["topFrame"].location.href="http://hobbysite.zz.mu/top.html";
top.frames["mainFrame"].location.href="http://hobbysite.zz.mu/Main/main.html";
}
</script>
</head>
<body onload="trigger();">
</body></html>

Related

Render React UI in play framework

I am trying to use React to render my UI in Play framework, but it doesn`t work. The same code just saved as .html file and opened directly can works normally, but if I place it in my play framework project as path: ./app/views/hello.scala.html, it just show title normally but nothing shown on my page. Here is my code:
<!DOCTYPE html>
<html>
<head>
<script src="./react/react.js"></script>
<script src="./react/react-dom.js"></script>
<script src="./react/browser.min.js"></script>
<title>React Title</title>
</head>
<body>
<div id="example"></div>
<script type="text/babel">
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example')
);
</script>
</body>
</html>
Please check weather all the js are loaded properly. check your assert path
<script src="assets/react/react.js"></script>
<script src="assets/react/react-dom.js"></script>
<script src="assets/react/browser.min.js"></script>

Applet Jpopupmenu displays away from specified coordinates

I have an applet within a browser which has a popup menu but when the menu is triggered it is shown away from the applet.
Here is the demo code
<html>
<head>
<title>Test the Applet</title>
</head>
<body>
<script type="text/javascript" src="http://java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes= { code:'AppletPopupTest.AppletPopupTest', archive:'AppletPopupTest.jar', width:300, height:300 };
deployJava.runApplet( attributes, null, '1.6' );
</script>
</body>
</html>
This issue only happens on Mac 10.8 using firefox 21.0. Safari works fine.

PhoneGap handle back button to not close the app

I have index.html and page.html
index.html has an anchor to page.html
I would the backbutton press and ask to the user if he really want go back to index.html
This is my code:
index.html
<!DOCTYPE HTML>
<html>
<head>
<title>First App</title>
<script src="cordova-2.6.0.js"></script>
<script>
function onLoad(){
document.addEventListener("deviceready",onDeviceReady, true);
}
function onDeviceReady(){
navigator.notification.alert("PhoneGap is working!!");
}
</script>
</head>
<body onload="onLoad();">
<h1>Welcome to PhoneGap</h1>
<h2>Edit assets/www/index.html</h2>
Go to page
</body>
</html>
page.html
<!DOCTYPE HTML>
<html>
<head>
<title>First App</title>
<script src="cordova-2.6.0.js"></script>
<script>
function onLoad(){
document.addEventListener("deviceready",onDeviceReady, true);
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onDeviceReady(){
navigator.notification.alert("PhoneGap is working!!");
}
function onBackKeyDown(e) {
navigator.notification.alert("PhoneGap back is working!!");
}
</script>
</head>
<body onload="onLoad();">
<h1>Welcome to PhoneGap Page</h1>
<h2>Edit assets/www/page.html</h2>
</body>
</html>
The problem is that the back button press is not handled, but cordova is loaded correctly because I have the alert box showed.
What I am doing wrong?
I have a Samsung Google Nexus with Android 4.2.2
Thanks a lot.
Put your back button listener inside of the onDeviceReady function.

getting an immediate redirect. Why is this so?

I am trying to redirect the user from one jsp page to another jsp page after making him wait for 10 seconds or 10000 milliseconds. But there is a redirect as soon as the page is opened in the browser. Why is this is so ? Is there anything wrong in the following code ? I am calling the redirectFunction which does the redirect.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP - 1</title>
<script>
function redirectFunction() {
<% response.sendRedirect("jsp-2.jsp"); %>
}
</script>
</head>
<body>
<h1>
Wait while you are redirected...
</h1>
<script type="text/javascript">
setTimeout(redirectFunc,10000); // wait for 10 seconds,then call redirectFunc
</script>
</body>
You sends redirect exactly from server that`s why it fired immediatelly.
If you want to fire redirect after 10 seconds than you need to change your code:
function redirectFunction() {
window.location.href = "jsp-2.jsp"
}
and setTimeout(redirectFunction,10000);
Actually when you call <% response.sendRedirect("jsp-2.jsp"); %> Java server sets http code 302 to your http response, and header Location: jsp-2.jsp
And browser redirects to page specified in Location header immediately.
Hope it helps.
the code in scriptlet is executed on the server, it is not javascript. use this
function redirectFunction() {
window.location.href = "jsp-2.jsp";
}
Assuming you're using HttpServletResponse, what's happening is that you're sending the HTTP location header with a status code 302. This happens when the page is requested, not during client-side execution of the JavaScript.
If you want it to be during JavaScript execution you need to assign the URL you want to window.location.
window.location = "http://google.com";
for example
This is because
<script>
function redirectFunction() {
<% response.sendRedirect("jsp-2.jsp"); %>
}
</script>
is translated and executed as
out.print(" <script> function redirectFunction() {");
response.sendRedirect("jsp-2.jsp");
out.print("</script>");
The call sendRedirect is executed on the server side, while preparing your page, and it's performing the redirect. You can do the sleep and the redirect in javascript only, using window.location.

Can you force focus on a calling IE window on the close of a child IE window in Windows CE?

I have a struts application being used on handheld devices running Windows CE 4.2/5.0.
We needed the functionality of another app in this one, and the solution was to pop up a window to the other app (using window.open()), run the process, and then close the window to return to the original app.
Normally our apps always focus on a specific textbox after an action. When the new window closes, the original window does not become the active window, and I'm having a hard time figuring out how to activate the window and focus on the textbox.
Is there a way to control which window becomes active when it closes and to trigger a focus event on the required field?
Thanks in advance for your help.
EDIT: In case anyone comes across this question, it turns out accessing window.opener is not available in Windows CE unless the OEM specially included it in their version of the OS. See this knowledgebase article for more information.
Not sure about Windows CE but with JavaScript you can use window.opener to refer to the parent window from within a popup. I wrote a little example to demonstrate. Hope it will be of help to you:
Save this as parent.html file:
<html>
<head>
<script type="text/javascript">
function openPopup() {
window.open("child.html", "", "dependent=yes,directories=no,height=400px,width=600px,menubar=no,resizable=yes,scrollbars=yes,status=yes,title=yes,toolbar=no");
}
</script>
</head>
<body>
<input type="text" name="txt" id="txtId" value="blah" />
<input type="button" name="btn" value="Open popup" onclick="openPopup();" />
</body>
</html>
and this as child.html:
<html>
<head>
<script type="text/javascript">
function goToParent() {
window.opener.focus();
window.opener.document.getElementById("txtId").focus();
window.close();
}
</script>
</head>
<body>
Push the button to close this window and focus on the parent's textbox<br />
<input type="button" name="btn2" value="Close popup" onclick="goToParent();" />
</body>
</html>
Your popup should close and focus should be gained by the calling page, even if it is in the background or there is some other windows on top.

Categories