How to redirect parent window from an iframe action

0 votes
What JavaScript do I need to use to redirect a parent window from an iframe?

I want them to click a hyperlink which, using JavaScript or any other method, would redirect the parent window to a new URL.
Sep 2, 2020 in Java-Script by kartik
• 37,490 points
1,425 views

1 answer to this question.

0 votes

Hello @kartik,

Use this:

window.top.location.href = "http://www.example.com"; 

Will redirect the parent iframe.

Hope it helps!!

Thank You!!

answered Sep 2, 2020 by Niroj
• 82,580 points

Related Questions In Java-Script

0 votes
1 answer

How to access iFrame parent page using jquery?

Hello @kartik, To find in the parent of ...READ MORE

answered Sep 3, 2020 in Java-Script by Niroj
• 82,580 points
806 views
0 votes
1 answer

How to embed an External Page Without an Iframe?

Hello @kartik, You could load the external page ...READ MORE

answered Sep 9, 2020 in Java-Script by Niroj
• 82,580 points
1,133 views
0 votes
1 answer

How to manage a redirect request after a jQuery Ajax call?

Hii kartik, You can resolved this issue like ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,580 points
9,179 views
0 votes
1 answer

How to access PHP session variables from jQuery function in a .js file?

Hello, You can produce the javascript file via ...READ MORE

answered Apr 29, 2020 in Java-Script by Niroj
• 82,580 points
5,066 views
0 votes
1 answer

How to access PHP var from external javascript file?

Hello @kartik, You don't really access it, you ...READ MORE

answered Jul 6, 2020 in Java-Script by Niroj
• 82,580 points
1,709 views
0 votes
1 answer

How do I escape a single quote in SQL Server?

Hello @kartik, Single quotes are escaped by doubling ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,580 points
1,941 views
0 votes
1 answer

How to specify a port to run a create-react-app based project?

Hello @kartik, You could use cross-env to set the port, ...READ MORE

answered Jul 22, 2020 in Angular by Niroj
• 82,580 points
1,861 views
0 votes
1 answer

How do you set a default value for a MySQL Datetime column?

Hello @kartik, In version 5.6.5, it is possible ...READ MORE

answered Aug 18, 2020 in PHP by Niroj
• 82,580 points
1,101 views
0 votes
1 answer

How to call a parent window function from an iframe?

Hello @kartik, Using Window.postMessage() This method safely enables cross-origin communication. And if ...READ MORE

answered Sep 3, 2020 in Java-Script by Niroj
• 82,580 points
502 views
0 votes
1 answer

How to show a different value from an input that what will be received as php?

Hello @kartik, You can't change the field's value ...READ MORE

answered Jul 7, 2020 in Java-Script by Niroj
• 82,580 points
1,615 views