browsing inside an iframe - url

I have a wordpress page that loads an
iframe prompting the user to navigate through bing to a webpage he/she wants. After browsing and upon arriving at the page the user wants he/she has to press a button to copy the current ulr to the clipboard or to print the url through alert() or on screen.
Question: is there a status attribute or something else that can give me the current status / metadata of the iframe (i.e. what page the iframe is visiting at a specific moment?). Thank you very much!

You cannot, it is forbidden to access any contents of an iframe that is not from your own domain, this is because of cross-site scripting restrictions.
You can read more about that here:
http://en.wikipedia.org/wiki/Cross-site_scripting
If you would be on the same domain however, you could do something like this in jQuery:
var url = document.frames['example-frame'].location.href;
when you would have an iframe like so:
<iframe name="example-frame" src="www.example.org"></iframe>

Related

Google Analytics: how can I track a click that redirects to an external url?

I have a URL in my (Ruby on Rails)web application that links to an external page (iTunes app page) and I would like to track visits to that link. I'd also like to be able to track the utm_campaign variable so that I can see how many visits different campaigns are sending to this URL. I don't think I can do a 301 redirect here, since Google Analytics is using JavaScript. How can I accomplish this?
EDIT: to be more specific, the URL is there to use in marketing materials (fliers, etc.). There isn't an actual link in the application.
Couldn't you write some JS that captures the click event of the anchor, increments a counter, and then fires up the href of that anchor in another window (target="_blank")?

Facebook canvas app dialog redirect

Wanna execute user-to-user request dialog initiated by server side.
On my FB canvas application I have button "invite my friends". After user presses it, the POST request goes to my server and i redirect to FB request dialog using the following C# MVC code:
return Redirect("http://www.facebook.com/dialog/apprequests?app_id=MY_APP_ID&message=MESSAGE&redirect_uri=MY_APP_CANVAS_URL");
What i'm getting on Facebook canvas instead of "select users" dialog is the blank page with the FB logo href-ed to target page. How do i this confirmation to disappear?
Facebook typically doesn't allow for the content of a canvas page to be one of their dialog URLs. The way most developers work around this is to issue a client-side redirect to an absolute URL that redirects the entire page, instead of just the canvas iframe content.
For your purposes, you can achieve this by serving a minimal page as the response to the POST request that contains the following markup:
<script>
top.location="<%= (insert apprequest dialog URL here) %>";
</script>

Facebook Application and URLs

I developed a Facebook application using Ruby on Rails but I have a slightly annoying problem.
When I click any URL inside the application the application redirects to the correct view and everything is working just fine but the URL on the browser is not updating accordingly. The problem is that if I click refresh on the page I will be redirected to the home page of the directory ( that's correct because the URL in the browser is the home URL ) instead of the page that I was.
Example:
App URL:
https://apps.facebook.com/example
Clicking the books link is showing the page correctly but not modifying the browser's URL to:
https://apps.facebook.com/example/books
So next time that I will hit refresh I will be redirected to the home page because the browser link is still:
https://apps.facebook.com/example
Any suggestions?
you need to be aware that your app is an iframe app(i assume you didnt use FBML), that means it is contained in a iframe. So when you create your links, add a target=_top will change the url.
When You create a link You must define target with _parent like:
link

When linking to a twitter/fb/other page, why do this: "dribbble.com/username/click?type=twitter" instead of a normal link?

I was just viewing a users profile on dribbble.com, they had linked their profile with twitter, when hovering over the link to go to their twitter page, it shows a url like this:
http://dribbble.com/thyraz/click?type=twitter
I'm wondering what the website/coding reason/advantage for doing this would be? why not just put a normal link to their twitter profile? does this protect the website from phishing attempts or something?
dribbble could be tracking/counting the links?
eg, "click" could be a page which counts the click, then it sends them on their way to the page.
EDIT:
For example, search Google for "Stack Overflow" and hover over one of the sponsored links on the right. in the status bar, you will see the link goes to a page hosted by Google rather than to the actual link. This page will be keeping a record of all the clicks on that link, then redirecting the link as expected.

Restricting page url to be opened into another by simply copying and pasting

When i Copy my url after logging into another browser it displays the same page instead of login page .This happens even after i close my page
Modify your session handling. The session ID should not show up in the URL (or at least not be used alone for authorization of the request).

Resources