I'm building a facebook app that should only be available to users via the facebook page tab.
This means the page may not load when openend outside the facebook page tab.
Is there any way the achieve this via PHP?
I thought of getting the parent url, but since the PHP is loaded inside the iframe I doubt it's even possible... Could go for a Javascript approach but I want to disable the access to the page server-side...
Thanks.
Related
I'm looking to get information from an external website, by taking it from a div in their code. But using the file_get_contents() method doesn't work because the information isn't in the source code for the page. It only shows up after the page loads (It's available if you use an inspect element in the web browser).
Is there a way to do this? Or Am I just out of luck on that?
I'm trying to make a page with some links and when somebody clicks on a link, the score count will go up.
How can I find out the visitor who has really seen the page related to link? But not just click the link and close the page for score...
really seen means: page loads completed.
and my links opens in new window.
any solution?
You cant really see pages that aren't in the same domain. Chrome even puts them in a separate thread.
Back in the day you could have used a CSS exploit talked about here: https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector
If you really want to make a page with this kind of functionality you will have to make a browser plugin/extension.
You can include a nonce token in the link, and post that token to the server, render the page embedding that same token in some javascript and have the javascript post back the token when the page is done rendering. Seems kinda overkill though.
The only thing I could thing of is maybe make the link to like a redirect page on your site and then you could control to see if the page was loaded and then like after the page was loaded redirect to the actual webpage to link is intended. This way you know for sure that the user waited to view the webpage.
Other than that I don't think there is any other way for you to go about this.
I am trying to use Ajax in a Project.
The Idea is when i click a Tab,
The Relevant Data should load according to that Tab.
But it also should append the Url on address bar of current form that i am in.
Let Suppose i clicked the ERP Tab, so then ERP Divs should load inside the page but also the relative url should also show
e-g
www.mydomain.com\erp
i know about .load function, but with it it dont update the url on address bar.
plus data will be coming from different files.
Also Left Side Menus will be coming from Database on Role Base.
i am using codeigniter in this project
i want to have Url functionality as it will be easy for user to access that page directly with the complete url plus it also gives bookmark advantage too..
Here is the screenshot for more convenience.
AFAIK you can't change the actual URL without a page reload.
You'll have to use 'jquery-address' library. Check out https://github.com/asual/jquery-address
I would do two different things here:
To change the URL dynamically without page load, use the new history.pushState() method. If you are supporting older browsers, history.js is essentially the same API that falls back to a hashtag method. Note that these URLs are not accessible from the outside. Thus:
When a user travels to one of those URLs, default the open tab to whichever one you are trying to. You will have to capture the intended route and work some javascript magic on it.
Using the following tutorial I want my website to use AJAX to load the content (but also want to be able to use the back button etc. etc):
http://www.queness.com/post/328/a-simple-ajax-driven-website-with-jqueryphp
Ofcourse if someone has javascript disabled the website should also work (without Ajax).
The problem however comes when a javascript enabled user sends a link to a non javascript enabled user. Because javascript is disabled it will not handle the #-tag correctly and will just go to the homepage (so linking directly to pages from a javascript user to non-javascript user is impossible). Is there a way to resolve this issue (preferably php or htacces).
HTML5 gives us methods to alter the URL without refreshing the page https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#Adding_and_modifying_history_entries
This means you can update something without a page refresh but still give the user a url they can bookmark or send to someone else. These urls will work without JavaScript, as long as you have pages at those locations or are catching them with mod_rewrite or similar.
https://github.com/browserstate/history.js is a great little pollyfill which will use the HTML5 history stuff if the browser supports it, otherwise (Internet Explorer) it changes the hash of the url.
Basically, three steps:
code your "a" tags just normal: <a href='about'>About us</a>
in your javascript code, intercept all click events on <a> tags and navigate to # + this.href. So when they click the above url, you navigate to site.com/#about instead of site.com/about
in your javascript code, have a timer function that reads the hash value form the current location and loads a corresponding url (with # removed) via ajax
Since you code your html just as usual, the site remains fully accessible for non-js users, and, more important, for search engines' bots.
In response to the comments I can suggest the following:
redirect your home page via javascript from just site.com to site.com/js/
when <a href='about'> is clicked, navigate to site.com/js/#about
on the "js" page, have something like <a id=about href="/about">click here</a> for non-js users
Why not just build your application normally and then add the AJAX on top, rather than going the other way round and causing more work for yourself?
Ask yourself, why do you need AJAX page transitions? Does your app actually need them, or is it just because you've seen it on another site, like Twitter?
i've setup a application that has a path to:
www.some_page.com/index.php
on the page i have a link that goes to:
www.some_page.com/picture.php?number=123
this page displays in the same fb iframe application.
My question is how to get to www.some_page.com/picture.php?number=123 from an outside link?
if i just link to it it will take me to the page but outside the facebook app, and i need t to take me to that page inside the app..
i guess that when i click on that link i have to send the user first to accept the app access then got o that page ?!
any ideas?
Thanks
edit 1:
** what i want is to place a link to www.some_page.com/picture.php?number=123 on another site and redirect me that page inside the facebook app
There are 2 options to set a facebook app:
embed your www.some_page.com inside an iframe (this will make sure all your links will stay inside)
Follow this: http://developers.facebook.com/docs/appsonfacebook/tutorial/ and make sure you don't have target="_blank" this is a better option and your links should open in the same scope.