[OpenLayers-Users] viewing an external webpage within below openlayers map

Roald de Wit roald.dewit at lisasoft.com
Mon Oct 5 03:08:17 EDT 2009


Hi,

On 05/10/09 17:28, maning sambale wrote:
> I have a KMl layer showing links to an external webpages.  What I
> intend to do is, when a user clicks on the kml polygon and balloon
> will pop out showing the list of links.  Clicking on a specific link
> will show an html file from an external webpage below the map as a
> separate frame within the same page.
>
> Any example or code I can tweka and adapt?
>

There are several ways to do this. I prefer the following: use jQuery
[1] to change the behaviour of links:

     $('a[href^=http://]').live('click', function(evt) {
         $(evt.target).attr('target', 'foo');
     });

In English this means:
- for every 'a' node that has an attribute 'href' that starts with http://
- (even newly created ones)
- do the following:
- set the target of the link to the name of your (i)frame

(you would need to load jQuery before you can do this)

It would assume you have an (i)frame with the name 'framename' like this:

<iframe name="foo"></iframe>

But, this is just one option. Others might have better suggestions.

Regards, Roald

[1] http://jquery.com/

--
Roald de Wit
Software Engineer
roald.dewit at lisasoft.com

Commercial Support for Open Source GIS Software
http://lisasoft.com/LISAsoft/SupportedProducts/



The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.



More information about the Users mailing list