I have a couple of links of which I change location.href for tracking purposes.
The problem is that the links now no longer seem to open in a new window (which was accomplished using target="_blank")
Is this an error on my part or is this by design? Is there a workaround? I would prefer not to use window.open as that could get blocked by a popup blocker.
I'm passing the asp parameters using the url current page is files.asp and I'm using window.location.href=files.asp?action=deletefile to pass the action to the serverside
My code never got executed (like the page was cached) unless i put document.write("") before the window.location directive.
Here's the code:
function confirmDelete(x){ var potvrda=confirm("Kliknite OK za brisanje. Cancel za povratak."); if (potvrda==true) { trans="files.asp?action="+x; document.write("") window.location.href=trans; } else {} }
I'm trying to use the onload event to load a series of urls. What I find is that the onload function is only called one time no matter how large the array. Here is the onload function.
var next_win = 0; var win = window.open("", "", ""); function nextWin() { if (next_win < urls.length) { win. win.location.href=urls[next_win++]; }}
i have a really stupid problem with this line of code: location.href = "showreport.php?id=" + sText;
sText is an id of a job that's running on the server.
Showreport.php retrieves the job and outputs the result in HTML. At the same time job is removed from the server.
What happens is that some browsers (IE 6 mostly) like to GET the showreport.php TWICE. Of course the second time there is no job any more and the result returned is of zero length, which is very unpleasant ;-)
Headers sent by the browsers are (1st call): Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* Accept-Language: sl Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Host: veliswork Connection: Keep-Alive Cookie: PHPSESSID=tsghl22ijg4f6ba7a2mthggun6
Headers sent by the browsers are (2nd call): Accept: */* Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Host: veliswork Connection: Keep-Alive Cookie: PHPSESSID=tsghl22ijg4f6ba7a2mthggun6
Note the Accept tag. What's even more interesting, the accept tag of IE 6.0 that does not request twice is: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Note the (still) absent application/pdf, which is the target content here.
Can somebody explain to me, why two calls and if that can be prevented. I can reduce the problem by keeping the job for another minute or so, but these jobs tend to be rather large (>10MB RAM usage) when large reports are generated.
Why does that not work? adding that line gives me a javascript error of some sort in IE. I see nothing wrong with it. Yet if I take that out I don't get the error, if I put it in I get the error.
as i know href is a property of location but location.href(url) works fine with IE 6. i couldn't figure out how its possible? is it a kind of browser syntax-tolerance helping it to work? how the heck is this working?
problem I'm having is that the parent url has a # sign in it, like: http://localhost/mysite/me.html#01
i need the #01 to stay in the url after the refresh, anyway to do this? i tried using escape(window.opener.location.href) but that didn't work, as it escaped everything including the :// in http://
i also tried: window.opener.location.href(window.opener.location .protocol + "//" + window.opener.location.hostname + window.opener.location.pathname);
problem with that was i lost the #01 in the url, pathname didn't include it.
Ok I have tried and tried and cannot get this code to work in safari or google chrome.
Basically I am working on a shopping cart. The user will click the paypal pay now button. The form is submitted to paypal via a new window target="_blank"
I also need to refresh the current page. This will write shopping cart data to DB via php upon page refresh.
Safari and google Chrome will open the paypal window, but seems to ignore the javascript to refresh the browser.
FF and IE both work fine.
<script LANGUAGE="JavaScript"> function newPage() { self.location.href='https://www.artists2you.com/s/orderconfirm.php?ordernumber='.$_SESSION['ordernumber'].'';
I am creating a send to a friend link on my site. The link will open a pop up window, which contains a form.
I have a function that opens the centered pop up window, and it is called like so (the function declaration resides in an external script):
Code: onClick="newWindow('http://www.mysite.com/send.php','',âÆ',ò“','')" I now need to append the current page's URL to the end of the URL ike so:
onClick="newWindow('http://www.mysite.com/send.php?page=xxx','',âÆ',ò“','')" This is sso that I can then use PHP in the pop up toget the variable from the query string.
I know that I can use location.href to get the current page url, but am not sure how I would include it in the onClick.
I have tried the following:
onClick="newWindow('http://www.mysite.com/send.php?page=location.href','',âÆ',ò“','')" but that doenst work...
I guess this is an easy question for all javascripters but I don't know how to manage (I'm pretty fresh with JS). I found two solutions on this forum but it seems that they don't work(?).I want to delay for few seconds window.location.href="destination_site.html" before it will automatically take visitor to destination site. It has something to do with setTimeout but I would be greatful for posting a fixed code.
I need to change the location of the parent window and after that scroll a little bit (because of "position:fixed" css buttons, which obscure the title).
I have window.opener.location.href = "newhreflabel"; window.opener.scrollBy(0, -25);
The newhreflabel may point to the same document or load a new one (another chapter).
There is a problem is with timing, T think I need to serialize those two instructions.
However, the window.opener.document.onload does not seem to be trigered by href change. Is there any other way how to do it - or I have ti all wrong?
every time i try something it doesn't work for me :( god why is this javascript so hard to make it work... anyway, i just followed the guidelines to pass values from one page to another using ? and it simply, like always, DOES NOT work .
I have the following code that I use to set the onclick function to top.location.href, but I need a way to extract the existing location.href from the onclick function, so then I can re-purpose it in the new onclick function. Any help would be greatly appreciated.
<script type="text/javascript"> var links = new Array(); links = document.getElementsByTagName("td");
for(var i=0;i<links.length;i++){ var tempfunc = links[i].onclick; //*****EXTRACT THE URL***** NEED THIS PIECE // var url = "http://www.sitepoint.com"; //say this is the url you extracted links[i].onclick=function(){window.top.location.href=url}; }
<input type="reset" name="cancel" value="Cancel" onclick="javascript:window.location.href('/index.php');" /> In IE5.5 clicking the cancel button loads the index.php page fine. In Firefox 1.0 & also the version of IE running on my IPAQ it doesn't work - clicking the button doesn't do anything.
Anyone have any ideas or alternative solutions? I thought maybe I was using an IE only thing but it is a version of IE on the IPAQ. I thought maybe it was not standards compliant but I haven't found anyone having a similar problem.
Any idea or advice? TIA, BG.
PS Ignore that I am using a reset button to do this - I have also tried it in the body tag like this:
Code:
<body onload="javascript:alert('Login Successfull! You are logged into my app');window.location.href('/myapp/index.php');">
When at the root of a site, without specifying a filename, a usual default of index.html (or even .htm) is loaded; however index.html does not appear in the location.href or location.pathname properties - only what you see in the browser address bar. I only have access to client-side Javascript (no server-side stuff at all).
Is there a way of getting this default filename from client-side JavaScript?
I know next to nothing about javascript and I don't even know if this is possible. I need to target window.location.href to an iframe on a different page. So, right now, the piece of the code that redirects the browser looks like this: window.location.href='http://www.somewhere.com/'; Works great, brings it up in the same browser window. So now I need to modify the code so it goes to a different page and brings that page up in a specified iframe.