Browser Back Button in Modal Window (Lightbox) - javascript

I am loading content from WebsiteA.com into a Modual Window (LightBox). The Modal Window is embedded on WebsiteB.com (and not WebsiteA.com).
The user is able to navigate within the Modual Window but if he/she clicks on the Browser Back button the Modual Window closes.
Is there a way to use the Browser Back button to navigate within the Modal Window?

Regardless of being on one website or two, it's not possible to override your browser's back button, due to security reasons (e.g. "fake" browser navigation", countless phishing opportunities, etc).
If they were on the same website domain, you could get around this using various methods, such as redirecting to the same URL, but with a different hash fragment.

Related

Open a window and share it among tabs?

I have a page that uses window.open() with a window name to pop up another window that will act as a presentation screen for my app:
window.open(url, 'my-presentation-win', 'resizable');
Now, that works well, and if I trigger that action, and then navigate to a different page, but then come back to the original page and trigger the action again, it brings the original popup window back into focus (the name is honored).
However, if I load the same HTML page in two different browser tabs (Chrome on OSX), and trigger that action in each, I end up with two different windows (each presumably with the name my-presentation-win?). Is there a way for that window to be re-used, when its used by the same app running in different tabs?
I don't think it's possible :(
Access a window by window name

Javascript - How do I detect when my popup window visits my site?

My site opens up a popup window to an external site, but at some point, the popup window will redirect to my site again. Because of security reasons, I know I can't look at the popup window URL until it redirects to back to my site. What I did is kept checking every second to see whether I could access the url address, and once I could, (meaning the popup window was back on my site) I stored the Url info and closed the popup. This seems like a pretty bad way of doing it...
Is there any way to detect the window returning to my site?
If you have control over the linkback page for the popup then you can set up a special page just for this purpose. All you'd need to do would be to create a page with some javascript that runs to notify you that you have come full circle.
One property that popup windows have is the window.opener property which refers to the parent window that initially created the pop-up.
This should be a good place to start.

Disable browser back button for a CLIENT_CERT auth webapp

My webapp has a CLIENT_CERT based JAAS authentication. I am using IE7.
When I click on logout, it takes me to my home page. Now clicking on the back button, the user should remain on the same page, which I acheived using history.forward() javascript. But the certificate dialog comes up since the previous page was secured.
How can I avoid the certificate dialog from not coming and also remain on the non-secure home page when user clicks on back button after logging out.
The only way to disable the back button within a window is to use location.replace() for every single interaction, which you cannot do if you need to submit any forms unless you target them to a hidden iframe and then do a location.replace() in reaction to the iframe's onload event once the form is submitted. This is really nasty and complicates everything.
The other technique to avoid users going back through pages (some online banking sites do it this way) is to launch the secure section in a new window, and have logout close it (you can force a close in IE with window.opener = null; before window.close();.

How to keep video playing when going back to previous page in JS

I have a page that has a table whose rows are links to other pages.
When there is a click on a row (link), I set location to that URL like this:
window.location=mytable.rows[temp_no].getElementsByTagName("a")[0];
And in one of those link, a video player starts to play a file in the link and I want it to keep playing when I go back to the previous page so that I can listen to the music when browsing other links.
I go to the previous page with:
window.location.href="..";
This destroys everything i.e. video player naturally. I can't popup a new window or open video player in a new window since this application works on devices which have single browser window.
Any solutions ?
Of course it does. Changing the location causes the full page to be unloaded and the new one to be loaded.
If you do not want this behaviour you'll have to use AJAX to reload only parts of your site.
Opening the video in a popup window would be another solutionbut new windows are usually annoying, so provide the user e.g. with a "open video in new window" link.
Edit: In this case - assuming the TV browsers have sane JavaScript engines - use AJAX.
Another "solution" would be adding an onbeforeunload event to request confirmation from the user before he navigates away from the page.
Without being able to use a new window or AJAX it is impossible unless you use frames and just load another page in a different frame.
Use window.open on your videos in a different window so the parent window can navigate wherever.
Keep in mind that you'll have to disable any pop-up blocker.
** UPDATE **
If you need everything in the same window, consider using some iframe to view other pages. The advantage of iframes is that they have their own CSS styles, Javascript sandbox so any page viewed within an iframe does not (generally) affect it's parent container. Of course, there are ways to communicate between an iframe and it's parent and vice versa. But this is out of the question scope.

Can I programatically make my website go to full screen via F11?

I want to make my page viewed at full screen.
How can I programatically press F11 on page load. Is it possible?
Thank you
No - not possible without JavaScript. And only then, you can open a large new window, but not emulate pressing F11.
Also, changing browser window sizes without the user's consent is very frustrating for them.
It is not possible to open a window full screen on load. It is not possible to resize the page you are loading.
What you can do is to open a max size child window, say on click of a button etc (if you do it onload, popup blockers would block it).
If it is a corporate intranet then perhaps you can add a rule to all your browsers to add your site to the popup blicker whitelist.
You can also use flash (etc) to open a document full screen, but this is not probably what you are looking at.

Categories

Resources