Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-08-2009
Member
 
Join Date: Feb 2009
Posts: 78
Unable to target javascript location .href

Is it possible to use an anchor to open a new window using target="_blank" and at the same time to use inline javascript to redirect the page in the first window to the previous page? I would like to have it open in a new window, i.e. target="_blank" but the target idea does not work.
Reply With Quote
  #2  
Old 14-08-2009
Member
 
Join Date: Feb 2006
Posts: 159
Re: Unable to target javascript location .href

You can ditch the hardcoded target attribute, as you intend to add it via the js anyway. I have been racking mt brain about this all day long and am having serious problems. Also, once the js function has done its thing, you want the browser to act upon the new href,

location.href="vbchsub.htm" target="myiframe";
location.href="vbchsub.htm"; target="myiframe";

The rest, it seems it is an almagame of all the ideas and lacking coherence.
Reply With Quote
  #3  
Old 14-08-2009
Member
 
Join Date: Jan 2009
Posts: 143
Re: Unable to target javascript location .href

If i want to load a page in an other target how must i do it??? with this script i can't give a target:

script LANGUAGE="JavaScript" FOR="window" EVENT="onLoad()">
<!--Window.location.href = "nobody" The one I really want to work is the one TSuji suggested.. does anyone have suggestions...
Reply With Quote
  #4  
Old 14-08-2009
Member
 
Join Date: Jan 2009
Posts: 134
Re: Unable to target javascript location .href

In most cases, this will avoid problems with popup-blockers too. For most sites, Google is going to be the single most important non-js visitor they get. In most cases, this will avoid problems with popup-blockers too. If you want the href to be set dynamically, but also followable by search engines, then you need to look at ditching js for a server-side option, such as PHP. You don't need javascript...

<a href="newpage.html" target="_blank">click here</a>

A good rule of thumb is to build the site as if js didn't exist and then, once you've established that the site is accessible, usable and useful, lay on some js enhancements aimed at making the userflow even better for those with js-enabled UAs.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Unable to target javascript location .href"
Thread Thread Starter Forum Replies Last Post
Set href value using javascript at onload Jaganmohini Software Development 4 14-05-2010 09:52 AM
How do I cancel a href in javascript? MAHESA Software Development 6 13-05-2010 11:50 PM
using href vs. onclick to call javascript function Kalyug Software Development 6 12-05-2010 10:09 AM
onclick=location.href (new window) Raja-Ji Software Development 6 12-05-2010 10:04 AM
Firefox Javascript Href issue Lalitmohan Software Development 5 11-05-2010 10:26 PM


All times are GMT +5.5. The time now is 03:15 AM.