google.maps.event.addListener(marker, "click", function() { window.open('http://www.example.com/'); });
http://roneiv.wordpress.com/2008/01/18/open-a-popup-window-in-javascript-with-windowopen-crossbrowser-solution/
http://www.google.com/search?num=100&hl=en&newwindow=1&q=window.open+cross+browser
--
Marcelo - http://maps.forum.nu
--
Look at the syntax of the window open method:
http://www.w3schools.com/jsref/met_win_open.asp
Have you experimented with the 'name' attribute to see if you can get
the behaviour you desire?
Martin.
On Nov 21, 9:38 pm, Roger Ertesvag <webfo...@webfokus.no> wrote:
> http://www.kamerakartet.no/gmaps_test
>
> To me this looks like a bug that should be fixed? Or maybe there is another
> way to code this that works better? Any suggestions would be highly
> appreciated!
Very non-professional, annyoing, confusing behaviour because nobody
would expect that a marker will be misused to open a new browser
window or tab.
I'd call this a bug intended by design.
Without doubt: Javascript can be (mis)used to force people to unwanted
actions.
There are many examples of annyoing and even risky and dangerous
scripts.
Most of these annoyances and risks can be avoided by using NoScript
which I use regularly because I know what's possible.
Yes, but window.open() is not part of any W3C specification or
technical recommendation. Furthermore, there are also differences on
how it is handled between various versions of the same browser and
between different operating systems. Therefore I don't think the issue
can be blamed on the API.
The different behavior could be due to the fact that, when you click
the marker, window.open is being called from wihtin a callback
function, while your other link, outside the API is direct.
See
https://developer.mozilla.org/en/DOM/window.open
most importantly:
<quote>
Specification
DOM Level 0. window.open() is not part of any W3C specification or
technical recommendation."
</quote>
and
<quote>
Never use this form of code for links:
<a href="javascript:window.open(...)" ...>
"javascript:" links break accessibility and usability of webpages in
every browser.
</quote>
I often have to write code that I don't like because my client
requested it, but the client often has a good reason for it. :-)