Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6924835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:42:45+00:00 2026-05-27T10:42:45+00:00

I know how to escape the iframe. I have a link: <a id=aaa href=http://localhost/projectManagement/users

  • 0

I know how to escape the iframe. I have a link:

<a id="aaa" href="http://localhost/projectManagement/users" target="_parent" >Sign up</a>

by clicking on that link I will escape the iframe

the problem is that I want to escape the iframe when clicking on a button not a link.

I know how to execute JavaScript with the click of a button so I have been working on executing that link with javascriopt

things I have tried out:

html: (it is inside a iframe)

<button onClick="tempEvent();" style="width: 500px; height: 50px; margin-top: -15px; font-size: 20px;">
      <b>
          click me              
       </b>
</button>
<div style="height: 15px;">
</div>
<a id="aaa" href="http://localhost/projectManagement/users" target="_parent" >Sign up</a>

JavaScript

<script>
    function tempEvent()
    {

        clickLink(document.getElementById('aaa'));  // this technique does not work on firefox!
        fireEvent(document.getElementById("aaa"),'click'); // this technique does not work in firefox eather.

        document.getElementById("aaa").onclick(); 
    }

    function clickLink(link) {
        if (document.createEvent) {
            var event = document.createEvent("MouseEvents");
            event.initMouseEvent("click", true, true, window,
                0, 0, 0, 0, 0,
                false, false, false, false,
                0, null);
            link.dispatchEvent(event);
        }
        else if (link.fireEvent) {
           link.fireEvent("onclick");
        }
    }

    function fireEvent(obj,evt){    
        var fireOnThis = obj;
        if( document.createEvent ) {
          var evObj = document.createEvent('MouseEvents');
          evObj.initEvent( evt, true, false );
          fireOnThis.dispatchEvent(evObj);
        } else if( document.createEventObject ) {
          fireOnThis.fireEvent('on'+evt);
        }
    }



</script>

I know I can replace the button with the link but I am just dont understand why I cannot achieve this!

edit

Even if I place the link inside the button it does not work!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:42:46+00:00Added an answer on May 27, 2026 at 10:42 am

    Javascript in parent:

    function redirectMe(url) {
        window.location = url;
    }
    

    Javascript in child iframe:

    function tempEvent() {
        parent.redirectMe('http://localhost/projectManagement/users');
    }
    

    You can bypass the <a> all together, and the whole clickLink/fireEvent is not really needed. If you did need to activate the click event on a link, check out jQuery and its click() function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I have this sign up script and I'm using mysql_real_escape_string .I know
I know I have to escape regex special characters in a search and replace
I know some of the escape characters in Java, e.g. \n : Newline \r
Does anyone know of an easy way to escape HTML from strings in jQuery
I've seen this post: NSString: newline escape in plist but I'd like to know
I have an iframe to preview some data. The data is stored in a
Does anyone know how to escape the square bracket character when setting a class
I would like to know how to escape phpdoc comments within a phpdoc comment.
let me know how can i escape the space in between, it may confuse
I know all versions of VSS have many horror stories and I feel I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.