Solved

DotNetNuke Text\HTML Javascript Redirect

Posted on 2010-08-31
7
1,073 Views
Last Modified: 2012-05-10
Hello,
I am sure this is a very stupid question, but I am rather new to web coding.
I am trying to make a simple little form in DotNetNuke with a Text\HTML module that will allow me to have a couple text entry boxes, and append those as querystring variables to a javascript redirect button. When I try do this with window.location.replace('URL') in my onclick, it just refreshes back to the same page (not the page I want to redirect to). when I use window.open('url') that works, but it goes to a new window.
What am I doing wrong?
0
Comment
Question by:markterry
  • 4
  • 2
7 Comments
 
LVL 6

Expert Comment

by:thaytu888888
ID: 33574082
- Try window.location = yourURL;
0
 
LVL 1

Expert Comment

by:talktodhand
ID: 33574123
function redirect()
    {
        location.href = "newURL";
    }
0
 
LVL 6

Author Comment

by:markterry
ID: 33574208
Neither work, also alert("Hello World!"); does work. I am starting to think there is something in the CMS stopping this code.
also thatyu888888, I thought windows.location causes a loop when people use the back button.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:markterry
ID: 33574260
okay, new news... window.location.redirect works in IE, but not Chrome or FireFox. So kinda good, but obviuosly I would want it to work in all browsers.
0
 
LVL 1

Accepted Solution

by:
talktodhand earned 500 total points
ID: 33574306
Hi,

works on IE,Chrome and FireFox too....
I have tried following code:

<html>
<head>
<script>
function redirect()
{
      window.location.href="http://www.google.com";
}
</script>
</head>
<body>
<input type=button onclick=redirect();>
</body>
</html>

Hope it will help.
0
 
LVL 6

Author Comment

by:markterry
ID: 33582582
that indeed does the trick talktohand. adding the window before location.href seems to be working.
0
 
LVL 6

Author Closing Comment

by:markterry
ID: 33582590
Thank you for your help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question