I'm trying to make a page divided in 2 frames. One that shows an external page... a shop for example,and other(mine) that offers related content to what is being shown in the external page.
I've been searching how to know the URL of the frame, but it can't be done due to security reasons(XSS, clickjacking, etc).
But I know it has to be one way to know it. I recently read that some plugins like the facebook's, have the ability to know where the client is while he is navigating.
I hope that my intention is clear. Do you know if this is possible?
Without having the site's owner install some JS on their site, you will find it very hard to find a cross-browser way to do this. FB do have people include a script and this is how they are able to access information cross domain.
You may be able to create plugins to do this, however you will have to create one per browser.
Related
What I am trying to do is to make something similar to what I see all the time on almost any website. The button that says Share to facebook. The goal for me is to let my guests share the item they are viewing in my store (Ran on prestashop) on their blog I run (Running on Oxwall).
The goal is for the button to not only link to a blog post submission webpage but to already have the subject line filled out with the item they are sharing's name and the blog post to display the information about the item. I would like to try and do all this using PHP. I am not sure how to go about doing it but I am sure that I could pass the value. Please note that I can mod BOTH the blog site and the shop as I run both and want to connect them.
As an extra bonus I am also running a forum using phpbb3 if I could do the same thing but onto that as well I would greatly thank you. I am trying to interlink everything into one big network. I know its not an easy task but I am sure there is an easy way to pass data onto the other site so that this can be done.
Facebook a 2 tools to get items informations in the page, it parses the page looking for the most common tags and it uses OpenGraph.
You can also provide product informations in the head of your page (between head tags), then blog side, you retrieve only the contents and parse it as XML.
I advise you to cache this data to avoid useless connections between websites and awful overloads while parsing.
You can use your own specifications, Open Graph or another standard, but i advise to use a standard.
I am trying to develop a web application for which I need to capture a specific user-driven event (such as mouse dblclick) occurring on a different-website page loaded through my website.
What I want to do is :
User visits my website - hosted by me.
There, user types in any website URL (e.g.: http://www.example.com)
That URL page gets loaded as is.
When user double-clicks mouse over any link or image from that page, a popup/side-panel is displayed with content related to that particular image or link.
I can do this with a combination of PHP get_page_contents or include-page, and javascript dblclick.
However, when user clicks on any link or submits a form, the control goes to that other website, where I cannot show the side-panel.
I might be able to handle the links by proxifying them when user clicks on any of them. How do I handle forms submission and other stuff ?
I can use a full-featured proxy, but that will be too heavy just for the purpose of capturing the event.
My question is that is there a way to write some kind of light PHP script that sits on my website - that loads other websites contents as is, but lets me capture the mouse-dblclick event to show related-content in the side panel .
I have already searched the internet, but could not find anything.
Any help is really appreciated. Thanks.
This sounds way too complicated to ever get reliably working IMO. Proxifying complex requests on 3rd-party pages? Maybe even with some additional AJAX that you'd have to proxify too? I may be wrong, but I think you'll go crazy and get swamped with complaints about sites not working.
I don't know what your web application is supposed to do but I would strongly consider building a Firefox extension (that has much more rights to access and do things on 3rd party sites) or similar.
I want to build a basically interactive website with these tools. I need to make a navagation bar with a submenu. Ex:
Services
then when mouse is over Services it looks like:
Services
boo
foo
I'm familiar with adding css styles, i'm just not sure about sub menus.
On the php side of things, I want people to select from the products and write their quantities, then I'd like a paypal button at the bottom which when clicked redirects to paypal and lists products ordered and their quantities (basically the paypal checkout page)
The other thing I want is a mailing list. I want people to be able to give their name and email and have a button that sends me an email so I can add them manually.
I would appreciate insight on any or all of these topics, maybe tutorials? I think I can manage the rest of the web site on my own.
Thanks
This is too many questions at once.
Dropdown navigations can be done with HTML+CSS alone. You can also realize them with JavaScript. Since PHP is server-side, you would only generate HTML, CSS or JS from that (if at all)
If you are just getting started with PHP, you might best be off first reading the PHP manual.. At least the chapter named Language Reference. There is also this free book on PHP available.
Sitepoint is also a good resource for beginners for any of the above topics. They have many good introductory articles, a good reference and many tutorials.
As for PayPal, consult the PayPal developer site to get information on how to integrate it.
Consider trying to build the page on your own first and then come back to ask individual questions, whenever you run into problems and googling them did not help.
I'm working on a site where we need "dynamic" breadcrumb generation.
Pages within this application are not specific children of the other, so when the user is browsing one of them, I can't simply retrace steps back up.
I could have the following breadcrumbs-like lists: (updated)
* inbox > message > user profile
* search results > user profile
* search results > user profile > new message
( FYI; there will be a few dedicated parent pages that will reset the whole stack. Also there will be a check that prevents recursion. )
So... To accomplish this, I have to remember where the user has been, and in what order. I reckon the most elegant and reliable way to do is, is write a mechanism that remembers the user's history in the session.
If I do that though, the whole thing will break when a user opens a new browser window or tab.
To fix that, I could store this data in the querystring. Though different browsers/proxies have different limits of data that can be transferred that way. So, one day, this will probably break as well.
Does anyone have an idea on how to implement this?
Or;
Does anyone know how to reliably identify different browsers windows?
(I'd rather not rely on javascript for this, unless it's my only workable option. I use dojo toolkit for the frontend)
thanks in advance!
On HTML5 compatible browsers I would save these on the local storage.
You can detect a new tab open like this:
on page load set a cookie by javascript
use the onbeforeunload event to clear the cookie
When the visitor will open your site, it will set a cookie eg session=1, if they click on a new link on your site, when they leave the site the cookie will be eg session=0 but as soon as they arrive again on your site it will be session=1.
When the visitor will open a new tab, it will encounter a session=1 so probably will do that session=2. You got the point?
window.name survives a new document load. So you can write a history string to window.name and then read it back from the next page, or use a generated name as a key for storing window-specific cookies/sessions.
I don't think this is a good idea though. “Breadcrumbs” are traditionally a hierarchical navigation device, not a history list. The browser already provides a perfectly good history list on the back/forward buttons that it is not useful to reproduce on the page; presenting an on-page history list, especially in a format that is normally a hierarchical place marker, is more likely to confuse users than to be of any help.
I asked a similar question a few months ago. The top answer - which I will am planning to go with - suggested building a path, and parsing that using a combination of mod_rewrite and PHP:
www.mysite.com/inbox/message/user_profile/12345/new_message
Up to a certain point (the request URL should never grow larger than 1024 bytes), that can be quite a good solution. An additional advantage is that the breadcrumb path can even survive sessions, and works in links forwarded to others (if that is desirable in your scenario).
Another thing, looking at your examples, I can't really see the need to reset the history when the user opens a new page, or to take different browser windows into consideration at all. There is a logical hierarchy (not a history) and why should the system start changing then hierarchy just because I choose to open the new message editor in a new tab?
I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com
ads2.sitename.com
unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a direct link, so I can't just make the individual subdomains header redirects.I'd rather use the subdomains that way I can manage multiple advertisers without changing any code on page, just code in my php admin page. Any ideas on how I can stick this jscript into the page so I don't need to worry about a blank ads1.sitename.com as well as the popup coming up?
I doubt you'll find much sympathy for help with pop-up ads.
How about appending a simple window.close() after the advertising code? That way their popup is displayed and your window closes neatly.
I'm not sure that I've ever had a browser complain that the window is being closed. This method has always worked for me. (IE, Firefox, etc.)
At the risk of helping someone who wants to deploy popup ads (which is bound to fail due to most popup blockers anyway), why can't you just have the subdomains load pages that load the block of Javascript the advertisers give you?
Hey, cut the guy some slack. Popups might not be very nice, but at least he's trying to reduce the amount of them. And popup blockers are going to fix most of it anyway. In any case, someone else might find this question with more altruistic goals (not sure how they'd fit that with popups, but hey-ho).
I don't quite follow your question, but here's some ideas:
Look into Server Side Includes (SSI) to easily add a block of javascript to each page (though you could also do it with a PHP include instead)
Do your advertiser choosing in your PHP script rather than calling the subdomains
Decipher the javascript to work out what it's doing and put a modified version in the subdomain page so it doesn't need an additional popup. Shouldn't be too hard.