I would like to be able to link directly to the individual funds on the page at https://cfrrrscholarships.communityforce.com/Funds/Search.aspx
If I copy the link, it just contains the following code:
javascript:__doPostBack('ctl00$PreContent$GrantsSearch1$grdFund$ctl03$lnkFundName','')
Is there a way to enter some variables into the address bar to obtain a unique address for each of these links on the page?
You can't in this case - the javascript pseudo protocol in the link anchor tag's href value is being used to execute a function call (to __doPostBack) in the page you are looking at, and provide the arguments used to submit a form to replace the current page content with the server's response.
In other words the href value is not a url, and an onclick handler on any number of different element tags could have achieved a similar result.
What the server responds with is, hmm, best known to the server and doesn't need to have a url accessible from the web. (It may have one, but that information is not contained in the page linked in the question).
Related
I'm trying to reference a URL in a local application and am having difficultly finding the correct path to reference.
It uses a value that the website transforms into another value for the page requested.
The main URL is http://exac.broadinstitute.org/
My inputs contain variations of rs113488022 , which the website will turn to a variant
http://exac.broadinstitute.org/variant/7-140453136-A-T
Unfortunately I do not have this variant value to pass directly,and am looking for the path of the on submit action from the front page.
Yikes, that is some horrible HTML code.
But if you inspect the input element you find that the form has a simple action /awesome, and the input’s name is query. As a consequence, you can simply perform a GET on the following URI:
http://exac.broadinstitute.org/awesome?query=rs113488022
Be prepared to process redirects, because the above will give you an HTTP response of 302 FOUND with a redirect location (which is the URI you found).
Note: The question is not how to fix the problem, as that is documented elsewhere on SO (e.g., Integrating Facebook to the leads to blank pages on some browsers / fb_xd_fragment).
1) What causes this, and under what conditions is it triggered?
2) More importantly, does this affect end users at all? For instance, how does this bug affect the URL shared by someone who clicks the FB Like button? If someone clicks the FB Like button from URL A, does URL A still get shared (but with "fb_xd_fragment" appended), or does URL A become your root URL (with "fb_xd_fragment")? In our logs, all the URLs appear as the root URL with "fb_xd_fragment" appended, so we're not sure if this is because people are clicking the Like button from the home page, or if all the shared URLs get morphed into the root URL.
Basically, what happens is whenever you use the JS API it opens your site in another iframe to use as a cross-domain receiver. What you can do is set a custom channel URL and it will use that instead. If seeing this bothers you, you can set a custom channel url. More information on http://developers.facebook.com/docs/reference/javascript/FB.init/
I have a situation where I need to change some CSS on a page based off the URL where the visitor came from. I'm using a form to submit a value to a new page (a checkout page) which is hosted on a different server/site than where the form resides. I have different forms sending this info over to the checkout page on 2 totally different sites. On this checkout page, if the user comes from site A, I need to add a certain class to a div. If the user comes over from site B, I need to add a different class to a div. Something like this:
if incoming URL is equal to www.abc.com, then addClass ('classABC');
if incoming URL is equal to www.xyz.com, then addClass ('classABC');
Am I providing enough information to properly evaluate this? Ideally I'd like to pull this off in jQuery but not sure if there's an existing plugin that can check this. One thing to note, not all the forms being submitted to the checkout page reside on the same pages (i.e. www.xyz.com/index.html). Some may be on different pages through each site, so I need to be able to figure this out based off the primary URL.
Thanks!
It should be possible to read the HTTP Refferer on the serverside. If you can then just put this value into a hidden input field like that <input type="hidden" value="the referer" id="referer-value"/> and read that hidden value for example using jquery like this var referer = $('#referer-value').val();. but as long as you can read the referer on the server you could also directly change the css file serverside.
To do this in JavaScript/jQuery you'll need to either add a URL parameter to the page to indicate which site it's from or use server-side code to embed the css in the page (which would be better). On the server you could do it with http referrer, but it's not 100% reliable so is still better to use a url parameter.
switch(location.hostname) {
case 'www.xyz.com':
case 'xyz.com':
$('div#yourid').addClass('classXYZ'); break;
case 'www.abc.com':
case 'abc.com':
$('div#yourid').addClass('classABC'); break;
}
Hope it helps!
I haven't found an answer to this, and since I'm pretty new to JS, I don't know if it's even possible.
I have a regular HTML form, where the only field is a user types in a URL (any URL) and clicks submit.
The URL will "be sent" to JS code that stores this URL in some variable, I guess. Basically, I need to be able to call getElementsByTagName() on any URL submitted by the user.
My point is to count up the number of times a URL contains a specified element, which I do know how to do :)
How do I interpret a URL submitted through a form by someone and then take that URL and be able to perform methods (such as getElementsById) on it? I want to return the count of the number of elements to the user.
Any ideas? Can this all be done in JS? Is this possible?
When you say "URL," I assume you are talking about the actual webpage and not the url string. In other words, you want to load the entire DOM into a javascript variable and then parse it with getElementsByTagName(), etc. Javascript cannot load this webpage due to the Same Origin Policy, unless users can only submit pages that are on the same domain as your site. If that was the case, you could use a frame. Otherwise, JS can't do it without Jsonp, which isn't going to work in this case.
However, all is not lost. You can have your JS make an asynchronous request (ajax) to your own server. Your server scripting language /can/ get the entire DOM of the webpage (e.g. PHP can do this with cURL). Then it can send the entire string back to JS as xml that can be parsed. Good luck.
You can't really do that from the client (the web browser) with nothing but Javascript, because security rules will prevent your page from fetching and examining content from a different domain. You'll need to send the URL to a server and have it do the work.
I run a website that has lots of affiliate links. These links are loaded via AJAX. I'd like to be able to track outbound clicks on these links.
The standard approach to using Google Analytics to track links is to use the pageTracker._trackPageview() function. I've tried this to no avail. Here's my code:
Link Text
As is suggested, I put my Google Analytics standard tracking code in between the opening body tag and the above code.
Does anyone see anything wrong with my code? Could the problem be the fact that the links are loaded via AJAX?
pageTracker._trackPageview('/event/outgoing?');
That should be recording a visit to "/event/outgoing?". Did you mean to record a visit to $link_loc? If so, you'll have to put $link_loc as part of the argument to _trackPageview. You should probably create a string containing only the host and path of the outbound link, minus the http://, and put that into your tracking code.
(I also wonder whether you should perhaps be putting quotes around the href emitted by the php code).
When you write "these links are loaded via AJAX", I assume that you parse the affiliate links via the affiliateLink class name, and then attach and onclick handler to them. In that case, it may happen, that those handlers were run before the _trackPageview was called you defined in the onclick attribute. Why don't you call the _trackPageview function in the same function that handles the outgoing links?