Solved

DotNetNuke Text\HTML Javascript Redirect

Posted on 2010-08-31
7
1,056 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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).

803 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