1 - Remove unwanted behaviour
Remove the javascript onclick
event as it is not needed. It is also actually what is causing you to get a new window because you are calling window.open
. This is eaxctly what you don't want. Copy the required url to the href
attribute instead of href="#"
.
2 - Set the target attribute
Change the target
attribute of the a
tag and set it to _blank
which is a built in instruction to tell the browser to open the link in a new tab. In older browsers, _blank
would open a new window (before tabbed browsers were around) but now all modern browsers will open a _blank
link in a new tab by default.
It should look like this:
<a href="https://maps.google.ca/maps?
q=3100+ReneLevesque+Quebec&ie=UTF8&hq=&hnear=
3100+ReneLevesque,+Quebec,+Qu%C3%A9bec+J4X+1C3&t=m&
source=embed&z=14&iwloc=A" target="_blank" style="color:#0000FF;
text-align:end" >Bigger Map </a>
Note
There are several built in target
attributes:
- _blank
- _parent
- _self
- _ top
Here's some documentation from Mozilla about the target
attribute:
This attribute specifies where to display the linked resource.
In HTML4, this is the name of, or a keyword for, a frame. In HTML5, it
is a name of, or keyword for, a browsing context (for example, tab,
window, or inline frame). The following keywords have special
meanings:
_self: Load the response into the same HTML4 frame (or HTML5 browsing context) as the current one. This value is the default if the
attribute is not specified.
_blank: Load the response into a new unnamed HTML4 window or HTML5 browsing context.
_parent: Load the response into the HTML4 frameset parent of the current frame or HTML5 parent browsing context of the current one. If
there is no parent, this option behaves the same way as _self.
_top: In HTML4: Load the response into the full, original window, canceling all other frames. In HTML5: Load the response into the
top-level browsing context (that is, the browsing context that is an
ancestor of the current one, and has no parent). If there is no
parent, this option behaves the same way as _self. Use this attribute
only if the href attribute is present.
Any other string you use will give the target of the link a name and then you can use that elsewhere to open other links in the same tab. E.g. if you call it "dave" then it will open a new tab which the browser will know as "dave". Any other link with target="dave"
will open in the tab the browser knows as "dave" - not a new tab.