Opening iframe is blank before clicking a menu item
I have an iframe on a web page that is on the opening page but the iframe is blank until a menu is clicked. Is there a way to show开发者_C百科 some "welcoming text" on the iframe on its initial load but not show it any other time? I think jquery may do this, not sure.
Web page in question is this: http://transeeq.com/health/bq16.html
I am a little unclear on what you want, so here are two solutions.
First, if you want the text to show every time the site is visited, but then disappear when a link is show, you can simply put content in your div.iframe-link
:
<div class="iframe-link"> This content will be shown then replaced. </div>
However, If you want a welcome message to show once, and then never ever again, keep reading:
First, you will need to use a cookie to remember that the message has been shown once. Secondly, you have no control over if the user has cookies turned off or if they have cleared the cookies, so there is a very strong chance they will see it again at some point.
I normally just use the scripts at quirksmode and edit them a bit, but there are jQuery cookie plugins out there.
Basically, follow this thinking:
- Check if your cookie exists
- If no, then write a cookie with a far future expires and call
$(".iframe-link").html("Welcome message")
- If yes, either do nothing or extend its expiration date and save the updated cookie.
精彩评论