magento
asked on
Magento Jquery - url open in new window
Hi,
In my top menu the are no of categories.
I added magento url rewrite for my blog .So when i click the category nccf it will take me to my external blog.
Currently it works fine, but i need them to open in new window instead open in same window
The html code below
I googled for it and find few answers but none works for me when i test using firebug.
Thanks
In my top menu the are no of categories.
I added magento url rewrite for my blog .So when i click the category nccf it will take me to my external blog.
Currently it works fine, but i need them to open in new window instead open in same window
The html code below
<li class="level0 nav-4 level-top">
<a href="http://shop.testdomain.org/auction.html" class="level-top">
<span>Auction</span>
</a>
</li>
<li class="level0 nav-5 last level-top">
<a href="http://shop.testdomain.org/nccf.html" class="level-top">
<span>NCCF</span>
</a>
</li>
I googled for it and find few answers but none works for me when i test using firebug.
Thanks
Add target="_blank" into the anchor tag.
ASKER
Gary ,
The above html was populated by php script so i cant able to do it for this particular category.
Thanks
The above html was populated by php script so i cant able to do it for this particular category.
Thanks
How are the links being created? What script?
ASKER
I dont know how it was created.
Is it possible to have a jquery when an href is clicked make it open in new window ?
Thanks
Is it possible to have a jquery when an href is clicked make it open in new window ?
Thanks
Is it just this link?
http://shop.testdomain.org/nccf.html
In your footer somewhere add
http://shop.testdomain.org/nccf.html
In your footer somewhere add
<script>
$(function() {
$('[href="http://shop.testdomain.org/nccf.html"]').prop("target","_blank")
})
</script>
ASKER
Modified ur code and then tried the below no luck.
mst( document ).click(function() {
$('[href="http://shop.testdomain.org/nccf.html"]').prop("target","_blank")
});
Why have you changed it - that would fire everytime someone click the page - waste of time and resources.
Is mst your local jquery name?
mst(function() {
mst('[href="http://shop.testdomain.org/nccf.html"]').prop("tar get","_bla nk")
})
Is mst your local jquery name?
mst(function() {
mst('[href="http://shop.testdomain.org/nccf.html"]').prop("tar
})
ASKER
Gary,
What i have done is , write a rewrite in magento for http://shop.testdomain.org/nccf.html.
When i mouse hover the NCCF link it shows href as http://shop.testdomain.org/nccf.html
But when i click it , it loads in same page and took me to another website url.
I need the same now but in new window.
I will try your code and post back the result tomorrow.
Thanks
What i have done is , write a rewrite in magento for http://shop.testdomain.org/nccf.html.
When i mouse hover the NCCF link it shows href as http://shop.testdomain.org/nccf.html
But when i click it , it loads in same page and took me to another website url.
I need the same now but in new window.
I will try your code and post back the result tomorrow.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Gary,
The above post worked like a charm .
Thank you very much.
BR,
Magento
The above post worked like a charm .
Thank you very much.
BR,
Magento