How to access url src and launch in new window

Posted on 2014-11-06
Last Modified: 2014-12-19
I've got a proprietary site that allows federated searching of internal and external sources. The external sources are returned in a tabbed interface and when you click the tab, the query is submitted to the external source and the results are returned within an iframe. Here's some code:

 $('#fs_tab_2').append("<iframe id='frameInline' name='frameInline' src='' width='98.8%' height='430' frameborder='0' onLoad=\"setHeight('frameInline');\"></iframe>");

I would like to grab the src from the iframe and -- instead of running the query in the tabbed iframe -- launch a new window and run the query there, i.e., spawn a new window with window.location=''

Is this possible? I don't know how to get to the iframe src. Can somebody provide the syntax?

Then, I'll need to replace the contents of tab title link <a href="#fs_tab_2">BING SEARCH</a> so the requestor gets the desired results in a new window.

Thanks for all help and guidance.
Question by:GessWurker
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 82

Expert Comment

ID: 40427357
Is this possible? I don't know how to get to the iframe src. Can somebody provide the syntax?

Assuming you're not the owner of, it's not possible.
The only way is to do a screenshot using a dedicated crawler or service on the net using server side code.

Author Comment

ID: 40427378
Perhaps I didn't explain things well. I control what's included in the federated search tab. I adjust the plug-in code used by another application (nothing to do with "Bing", per se) to point it to various providers. To add a tab to my application that runs the query against Bing, I include the plug-in code below:

<PluginSetting id="bing_search" DisplayName="Bing™">
<Param key="Url" type="string">
<Param key="UrlIsInternal" type="bool">

As you can see, all this does is submit whatever terms were run against the internal db against bing, as well. However, the results are returned (by current design) within a tabbed iframe. I'm trying to come up with a workaround. "Bing" could care less. "Bing" won't know the difference. I AM the owner of the application that submits the query in the first place.

Do you still believe it's impossible?
LVL 82

Expert Comment

ID: 40427387
it was clear for me.
you can ONLY get content of iframe if it's allowed by the content site or if it's the same domain address
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.


Author Comment

ID: 40427391
Even though I own the parent window, I can't get to the iframe src?

Author Comment

ID: 40427394
Anyway... I thought that since I was loading the iframe, I could access the contents.
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 40427400
No, you can get the source  (src attribute) not the content (html,body,document) of the iframe if it's a different domain.

here the way to get the src : document.getElementById("frameInline").src;

test page :

Author Comment

ID: 40427405
Ok. Thanks... that gets me a little closer...

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

724 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