JavaScript: How do you create a back link to a specific page?

Good day;

I have been using the following JavaScript in my web page, which works rather well:

<a href="javascript:history.back(1)">

Basically, I use the history tag in the above script which takes me to the previous page and it closes the active window.  This is very handy if your active window consists of Frames.
However; I need a link on my web page that closes the active windows (Frames or no frames) and takes you back to a specific page.  How can I do that?  I need no buttons or anything just a typical link.  
Currently, all I have been able to do is go back to the previous page.  Would someone help me with this?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

<a href="javascript:document.href='url';">text</a>

ie: <a href="javascript:document.href='';">Google</a>
sorry maybe you should use document.location instead,

<a href="javascript:document.location='url';">text</a>

ie: <a href="javascript:document.location='';">Google</a>
abastanpourAuthor Commented:
Good day;

Well the document.location works, however it does not close the active window.  I have a page consists of frames and I need it to goto another document.location and close the active window.
Right now when I use the document.location it opens the in the middle frame.

We are getting close.. any ideas?
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

By clear the active window do you mean clear all the frames?

try this:

<a href="javascript:window.location='';">Google</a>
abastanpourAuthor Commented:
I mean to close the active web page being displayed in IE, then open a new IE windows to Google or any other page.
Now, keep in mind that my page is made of three frames.  The code above displays Google in the middle page.  
I need it to clear/close all frames and take me Google or another page.  
Take a look at the web site I am working on:
Navigate to gallery link then hit the previous page link.  You see it closes the gallery page which is a frame.
Now on the gallery page, if you choose to see several pictures and then use the previous windows link, it will take you back to previously looked at picture.  I need it to take me back to the home page.
All the codes that I have seen displays the home page or in your case in the center frame.
I hope this helps.. Sorry, I don't explain well..  Hope you can help.. :)
Ok this helps, honestly, my suggestion to you is to learn how to use DIVs :) Frames are not well looked upon.

Here's a workaround; Add the script below, and change your link to javascript:goBack();

In "includetopframGall.htm":
<!-- Start new code -->

function goBack() {
var currentURL = new String;
currentURL = parent.window.location + '';
if (currentURL.indexOf('galleryFrame.htm') > -1) {
      parent.window.location = '';
} else {

<!-- End new code -->

That script is if you used the same html in the top frame for every page on your site, you could just use:

<a href="javascript:parent.window.location='';">Previous Page</a>

All depends on how your site is going to work.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
abastanpourAuthor Commented:
Thank you :)
This works very well:  <a href="javascript:parent.window.location='';">

I do need to understand and learn DIVs:  Not sure where I can start learning about it.  Perhaps an easy editor/software that would walk me through.  If you know one.. Please let me know, and you have any suggestions for our community web site please let me know..

Thank you :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.