I have a HTML page which I want to display on browser. This is a login page(https://localhost:9000/login). Before loading this over browser page I want to hit another url which gives me another html page . This url is basically to kill the existing sessions.(https:xyz)But this also redirects me to another page which I don't want to display . I want to remain on login page.
I think this is possible using iframes. I am newbie to iframes. Any pointers on how to achieve this?
That's a local link only viewable on your computer.
So you want to load another page, before the login page? If you want to kill existing sessions you can use sessionStorage for that.
There are a few things that don't make sense with this, but it's your project. like you want to redirect to another page, but don't want that page to display. That makes no sense to me.
You want to remain on login page, but when you login, you want to get another html page in the login page?
iframes are probably the worst thing in the world imo... you got so much going on here, but can simplify this so much. A login page to an inner page and then you go from there.
There are a number of ways to achieve the end means here, sessionStorage being one. Just search around here for answers, you can find a ton of them.
Good luck!
iframes have been removed from HTML specifications, you cannot use them in HTML5.
Use attribute target="_blank" in the <a> of this url. It will open in a new tab
Related
I have a question which I haven't been able to find the answer for. I hope you can help me.
I am about to build a simple website, containing text and hyperlinks. I want the site to have the same adress no matter which hyperlink is clicked. For example, if my website is www.website.com - when one clicks a hyperlink, the content of the whole page should change, but the adress should still be www.website.com, instead of www.website.com/hyperlink.html for example. In other words, I want to disable people to use the "back" button to return to an earlier page, and prevent them from navigating the page by writing in the adress bar. They should experience a single page, but still be able to navigate through a lot of changing content through links - which means that if they click the "back"-button, they will be navigated away from the website, and if they refresh the page, it will go back to 'index'. Can you point me in the right direction to which methods might be useful here? Earlier, I would have done it in Flash, and embedded the flash-construction into the website, but as far as I have heard, Flash is not the best solution anymore?
Thanks in advance.
First of all, that is not the best idea for SEO.
But that puts aside, you should use javascript to make AJAX call and alter the partial part of your page with the response.
So basically, what you will do is from your home page, capture all link clicked event, and process the request through an AJAX call, and display the result of that call on the same page.
That allow you to refresh a list of item, or a menu, or the entire page if you want.
Since it will be AJAX call, the user won't see any difference in the URL.
the requeirment is that I want to avoid the specific web page to save to bookmark,
and is there someway to acheive this funcion just use some code, maybe add or js code . thanks
The answer is no, the user can always bookmark a page as this is browser function, but you can use sessions. Then make sure that any request for a page
must have an active session id or it returns an error or redirects to the home page. The user can bookmark the page but the bookmarks will then only work for a short time (until the session expires). This also has the added benefit of
making the site impossible to index by search engines.
The closest you're going to get is if you open another window using JavaScript as you can control whether the menubar and toolbar are displayed.
window.open(
"https://www.google.com/",
"Google",
"resizable,scrollbars,status");
However, this is likely going to be blocked by their popup blocker.
I am making a website for my friends band. I would like to know if its possible (apart from using Ajax) to keep audio playing after clicking on a link to another page on the site?
I currently have it set up using Ajax to reload the content, but I am having a few issues with it, and I'd rather not deal with the bother unless I really have to.
If not possible, is there a way to minimise the disruption (pausing then playing again) while navigating? It would be possible for the new page to continue playing the track from where the last page stopped, but I would like to minimise the pause. Or, on this subject, is it possible to keep certain page elements loaded after changing the URL (without using # urls), like facebook does (as in, you click on it, but the banner never disappears during loading)
Thanks for any help :)
Use Ajax to load content and History API’s pushState() to alter URL without page reload.
For consistent behavior across browsers, consider using a wrapper library like History.js.
Sites like Facebook use JavaScript/AJAX for these kind of things. If you don't want to use it, you can use frames (not recommended). Divide the page in two frames: the player and the website itself. This way you can easily turn it off too, just open the site without frames.
Good luck!
Of course you could also pop up the player in another window/tab.
(For now) It won't be possible without frames or javascript.
It might be troublesome to implement it differently than via AJAX, however you can either use IFrames, where the music would be played in the main one and the content is displayed in the child on or you can always make it a Flash webpage.
Build it in Wordpress and use the AnythingSlider plugin to have the pages shift within the main page. This way you can have tabbed navigation and never leave the actual page. No need to write too much code. The AnythingSlider uses html for the slides.
You can also not use wordpress and just use the AnythingSlider code.
http://css-tricks.com/anythingslider-jquery-plugin/
and
http://wordpress.org/extend/plugins/anythingslider-for-wordpress/
and
http://css-tricks.com/examples/AnythingSlider/
We need to implement a mechanism to persist information between web pages in the same session. There is a lot of information on the client-side and passing it back and forth to the server across requests is something we want to avoid. HTML5 local storage is one option.
The other option mentioned was "using a hidden frame where the data is kept". I am not sure what this option really means.
Does it mean keeping a hidden frame that holds on to the data across page requests?
How would this be accomplished? Are there any jquery plugins or sample code I can look at?
What are the advantages and disadvantages?
I am not aware of a way where you can keep data in the main page and use a hidden iframe/frame to persist data. This is because once the main page is reloaded (when you go to another page), everything in the iframe is lost.
You would basically use the main page as your data-storage location. On top of the main page, you would superimpose an iframe. The user would interact with your site through the iframe. From the user's perspective, there is no difference. You can persist information by writing to the parent frame (the main page). Since the main page is never getting reloaded, you can persist data inside it.
I am not aware of any Javascript libraries that do this; I will take a look though.
Keep in mind that this might affect SEO and possibly navigation (not back/forward buttons). Another point, as Guffa noted, is that users cannot share links to your page since the URL in the address bar never changes (all interaction is via the iframe). So when your user sends someone a link, they will end up at the very first page.
You can't keep a frame from one page to another, so the only way to use that is to make the frame cover the window and load the actual pages in the frame. That way you can keep the data in the surrounding page that won't be replaced.
This of course means that you actually never leave the page. The URL in the location bar remains the same when the content changes, so you can't bookmark a specific page or share it with others. Search engines will link to the content pages instead of the frame, so anyone finding your page that way will end up on a non-functioning frame page.
I want to know how Facebook is doing their iframe footer bar. I mean, i know they have an iframe on footer, but i want to know how they are reloading pages without reloading the iframe also, 'cause the iframe always stick there even though the page does reload again. Any ideas/knowledge?
EDITED:
Try clicking on a link which is different section and it changes the url and so far i know, if you try to change the URL, then the page will reload again. Also, try using Facebook on Chrome: you will see it reloads on every new page. It's not AJAX, because the URL wouldn't change if it was AJAX (do little research on URL changing, you will know).
Well, powtac pretty much gave you the answer: Facebook doesn't reload the whole page when you click a link, it requests the new content via XMLHttpRequest and refreshes only those portions of the page that change.
It's pretty slick about this: a naive implementation might not use real links at all, thus preventing you from opening, say, a different Facebook tab in a separate browser tab.
This technique - intercepting link navigation - also allows Facebook to use custom prompts when you try to navigate away without saving, and re-write paths as fragments, allowing it to track the current location in the URL without reloading the page.
FWIW, this question has already been asked and answered - see: How are the facebook chat windows implemented?