I am developing a web application and my requirement is as specified below.
I need to display four websites in a single browser window...(which i implemented using frameset)
I need to refresh the whole page (which certainly will refresh frames inside ) after 1 minute to update the frames content....(which i implemented using the java script)...
however in one of the frames i need to login to the 3rd party website. i am able to login and able to view the content after the login...however when the page refresh happens after 1 minute the page will be redirected back to the login page again and i have to login after each page refresh...
I googled this and found that it might be due to frames which does not set the cookies.for this i have implemented P3P policy also but the problem persists...
please provide the solution if anybody knows about this...
The javascript I used to refresh a page is
function timeRefresh(timeoutPeriod) {
window.setTimeout("location.reload(true);", timeoutPeriod);
}
window.onload = timeRefresh(60*1000);
If the cookies for the 3rd party site are set then your P3P looks fine and you can navigate fine for over a minute without losing session then the problem must be something with the timeRefresh()
As you can't get a customized URL of the 3rd party site in order to issue a specific reload and assuming that you have no control over the third party site, I suggest you do something different. Set up some JavaScript to load an image from the site (the logo or something else that won't change, or alternatively a script or page) every minute from a frame that you have control over. Because the browser is the same, any existing cookies from a login will be referenced and it will extend the login.
Related
I have a question about loading javascript source and initialize function on a page depends on the user`s cookie preference. I have an API that I can check the user's cookie preference with javascript.
My first idea was to hide(with js) the app (which will be loaded on the page via 3rd party script source and initialize function) and show a message to the user that the user can't see the app/content because of his/her cookie setting. But on the legal side, it is allowed because even the user doesn't see the app/content it is going to be loaded on the browser.
My second idea was creating a script tag dynamically and adding in head and run the initialize function,
but in this case, if initialize works faster than script tag creating function, I get an error. And even if it works sometimes user has to reload page couple of times to load the app.
Is there any better practice/idea that you can advise me on?
I have a web app, part of which opens a 3rd party page in a child tab (I'm unable to iframe it as the headers they send prevent it) Once the user has completed the 3rd party page, the 3rd party present a blank white page with a GET parameter in the URL of "SUCCESS".
I'd like to be able to interrogate the url from the main tab and if it contains "SUCCESS" close the child window.
This needs to be cross browser compliant and written using Javscript / Jquery
Any ideas? is this possible?
As far as i know (someone please mention otherwise), you can not trigger the browser to close an external page.
That would be a major security issue, imagine if you visited a site, and it decided to close all your other tabs ? Opens to many malicious possibilities..
Also regarding PWA, the possibilities are limited as to their power, depending on the phone, they run inside more or less restricted frames of the browser, especially on iOs..
Maybe you can look into “bypassing” the iframe restrictions, that way you’d simply be able to toggle it off with JS or even Css.
What are those restrictions, do you have code?
Also, how you invoked that 3rd party page to open in the background, could be relevant.
I have the next task - I have a page where we have some interaction logic:
After a user clicks a button, my script redirects the user to another site where it must be populate 2 textfields then click button, after redirect to new page it must click on another button.
My project is based on ASP.NET MVC4.
My questions are:
May I do all of this?
If yes, how can I redirect to another page and run my script
P.S.: Second web site isn't my site and everything I know is id of buttons where I need to click.
Elaborating on my comment
You cannot do this in a normal browser. You could write a bookmarklet or two that would navigate and click but there is no script you can write in a web page that will do what you want for security reasons. A long time ago, it was possible in IE to load a banking site into an iFrame and script and monitor user interaction to steal credentials. This has been blocked.
If you save an HTML page with the extension HTA, it can be loaded from harddisk in windows and will have relaxed security so you could load the other site into an iFrame and script the interaction. This is likely not what you want.
The last method is to use for example CURL to get the foreign page, insert stuff and submit the form to the foreign site and return the result. This is not recommended either.
So the question to you is: Why do you need this and are there other ways to do what you want
1) location.href = "http://another.page.com"
2) impossible for security purposes
How to make static fixed HTML element on every page of site?
I mean - for example, it is music player on site. It's displaying in corner of page, and while navigating on site - it doesn't reload.
Also, If you open many pages of site (different tabs) than state of this element is the same on all pages. (If I change something in this element on one page - it's changed on every page).
For real example I can provide a link (I think, it's allowed to do this on this site):
http://www.jamendo.com/en/album/40689
If you click "Play" - music player is opened. If you open other artist in other window - two players will be the same. If you have changed volume in one window - volume is changed in other too.
What techniques are used here? Can you give some references to read about such technologies?
Hopefully the site is working the same as it was when you posted the link...
This site is using Flash which seems to be using LocalConnection and ExternalInterface. The Flash object in the popup is the one actually playing the music. The controls on the page are calling a Flash object on the page which just sends commands to the popup.
Well I can give you a general idea of how I would do it.
You would need to persist the data of the feature you wan't to be the same across all pages.
For example: if you wanted something to be in the same position across all pages, you could store the current position of that variable in a session variable, cookie, or database for that particular user/ip address. Then you would make GET requests to the server "asking" for the most recent position of whatever you're tracking. And if it's different update the position accordingly.
You would need to make use of Javascript, A programming language, and some kind of data persistence.
If you want to read about the newest stuff, you could easily do this with node.JS. There is a library out there that makes it very easy to reflect server side changes on the client w/o making GET requests (making it a good for chat applications).
You can use local storage to store the current settings and poll them from each open instance. You won't need to use AJAX or the server if you only care about the settings being synchronized across one machine.
Im hosting a rails app on heroku. It runs on the client on a touchscreen with Google Chrome in Kiosk mode, so no browser chrome or keyboard. The login/home page is different for every kiosk.
Error pages are static assets, so I'll have to do this with Javascript. If there is an error I want to display a button that will let the user get back to the home page.
I can't just use a back button script b/c of the potential for multiple errors. I thought about using localstorage to store a reference to the home page, but the error pages are served from a different domain so they wont have access.
Any ideas?
Edit:
This works in Firefox onClick="window.home();" If I set the browser's home page to that particular kiosk. But apparently isn't supported in Chrome. Is there any way to store some kind of variable that any domain can access on a per browser/kiosk basis.
I think you're making this too hard. You already have the information you need to go back stored in "local storage" -- the browser history. Simply use javascript to look at the history and go back as far as you need.
As far as returning to the home page, isn't the home page a well known URI? What's wrong with go home?
Update
Isn't the home page always going to be the first page in the history? You seem to be saying that you're in a situation where you want to return to a page for which you don't know the base URI, don't know how you got where you are, and don't know where you started.
I suppose you could put the place you'd like to go into a cookie, but if you don't even know the base URI, how would you retrieve it?
I'm beginning to think the real answer is "you need to rethink your design, there's something deeply wrong."