473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Open new window from an iframe link

1
Hi,

I have an iframe with a site from a different domain. The iframe src contains links that I would like to open in a new window when clicked. Unfortunately, I can't get the target.href of the links. I think this should be possible since right-clicking the link and selecting open in a new window works. How can I make a regular left-click mimic the behavior of a right click->open in new window?

I can intercept the click using the iframe's onfocus property but I can't get the href of the link.

Here's a snippet of my iframe:
Expand|Select|Wrap|Line Numbers
  1. <iframe id="gadgetFrame" onfocus="bringLink(gadgetFrame)"  ...
  2.  
And here's the function that I have so far. The target.href comes back as being undefined.
Expand|Select|Wrap|Line Numbers
  1. function bringLink(id) {
  2.     if (event == null)
  3.         event = window.event;
  4.     var target = event.target != null ? event.target : event.srcElement;
  5.     alert(target.href);
  6.     //open(target.href);
  7. }
  8.  
If anyone has any ideas, I would really appreciate it!
Thanks,
LizF
May 1 '07 #1
1 7496
acoder
16,027 Expert Mod 8TB
In bringLink, you'll need to have the event as an argument for non-IE browsers.

The event is a focus on the iframe. How can you be sure it will be a link and have an href?
May 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ben | last post by:
Hi there, in a form, here's what I want to do : <input type=button onclick= (???) is it possible to open a pop-up window with a specified url without using javascript ? Thanks
1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
3
by: Grey | last post by:
I know I need to use client side script to open new window, window.open("URL"). However, the URL in the function is dinamically generated by server side. How can I open window in client side, but...
4
by: gabe | last post by:
i have a solution to gather the text in each window that is open, but would rather use only managed code rather than unmanaged code my current solution relies on. The purpose is to get the text in...
1
by: Alejandro Vidal | last post by:
Hi, I have a curius problem, I hava a flash in a html page. In flash I have a button to open a pop up with this code: getURL...
2
by: Martin Mosbæk Christiansen | last post by:
Hi I have been searching this group but I haven't found anything I can use... Is it possible to remote modify an already open window form from a local HTML file? Example (simplified): 1....
1
by: peerraghu | last post by:
hi i am creating travels project using .net and c# and iam new to java scripts i want to open new window with in the same page after clicking the image i have wreiten code just look at this ...
1
mageswar005
by: mageswar005 | last post by:
Hello, In My Application i have open the PDF file from javascript open.window function.In This scenario i want to control / Hide the PDF Toolbar from open.window function. My Current code is...
1
by: hcoulange | last post by:
I am trying to open a window inside a DIV or a table cell. In the stylesheet I put a #container and a #jx, In my page I have first a div id=container and another DIV call jx the first with position...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.