I have a page with a iframe in it. On the main page there is a menu. On click of a menu item page gets loaded in to the iframe. There are many hyperlink in the loaded page. Now those hyperlinks should be opened in the same iframe.
When some one clicks the hyperlink it will load a page in the iframe.
My question is :
instead of loading the page which is defined in the src="" of hyperlink I want a different page to load after the user clicks the hyperlink.
I need the java script to change the src="" parameter.
I am working in PHP.
You need to call a javascript function on click of hyperlink and in that javascript function you need to redirect to different url, return false in onclick event of hyperlink
open
<script>
function openURL(){
window.location.href="http://google.com";
}
</script>
Related
I am parsing a page using an iframe.
I need the href element from a link. This link only display hashed data though. On click, the link trigger a popup, which has the right URL I am trying to grab.
How to get it without leaving my main iframe page, and stopping my javascript ?
I grabbed the link using Jquery dom to print a console.log(link.click());
The popup is blocked and it only return me some hashed data.
<div class="blEntry website" data-ahref="PFnGSCJIiuCWJcVt84pIaQtipEnV1zS0pIaQaVMSpa1EVTVEEJc" data-column="2" data-trackingkey="URL_EATERY" data-eventname="bl_contact_website" onclick="ta.prwidgets.call('handlers.onWebLinkClicked', event, this)">
<span class="ui_icon laptop"></span>
<span>Site Web</span>
</div>
Simulating a click open the popup, which has the URL. I don't figured out how to get the URL when the popup try to open.
Is it possible to implement this behavior:
I have a HTML link on one page, and after a user clicks on it, it goes to another page which has several tabs on it. Upon clicking on one of those tabs, it triggers an AJAX post call which populates and displays content for that tab.
I would like that when a user clicks a link on the previous page, it takes him to another page and automatically clicks a specific tab so it triggers an ajax call which displays the content for that tab.
This site is a Wordpress site, if that information helps at all.
On the 'from' page you can have links such as
Click Me
You can set an onpage load function to load and use a trigger like this
if(window.location.hash === "#customHash"){
//my custom tab loader
}
You can use jQuery Cookie plugin to achieve this. http://plugins.jquery.com/cookie/
You just set the cookie on the first page, when the user clicks on the link
$.cookie('the_cookie', 'the_value');
And on the next page use the jQuery on load function to check for the cookie.
I know how to use fancybox popup, normally, which means making an link and click open the fancybox.
But the requirement is, if the user presses a link without logging in,
it has to refresh the page with the popup already opened.
Is this possible in fancybox?
use jquery click trigger
Script
$("#autostart").fancybox().trigger('click');
HTML
<a id="autostart" style="display:none" href="select_category.html" class="fancybox fancybox.iframe"></a>
I would like to improve loading performance for a page that has a button to trigger a popup initially hidden on the page (uses 'modal' component from twitter bootstrap). This popup body contains an iframe, which source is loaded on the page inital load adding about 30-40% more time to load, however. The iframe source is not needed to be loaded till the button is clicked which brings up the popup with the iframe. How can one avoid loading the iframe source on initial page load? ...only load the iframe source when the button is clicked? Can JS be used here? If so, then how or what method/library? Is there a better approach than make popup with iframe hidden in the page to improve loading time? Thank You
This is possible with JavaScript (no extra libraries required).
Simply use a function to set the src/display the frame when a link or button is clicked.
function loadIFrame(frameID, url) {
var frame = document.getElementById(frameID);
frame.setAttribute('src', url);
frame.style.display = 'block';
}
See the example here:
http://jsfiddle.net/ZNGmy/
Rather than having the pop-up as a hidden container that is made visible by the button, make the pop-up with the iframe content a separate html page that gets displayed by pressing the button. This way the content is not loaded until the button is pressed.
This link has an example of popping-up html pages.
http://allwebco-templates.com/support/S_add_pop.htm
Actually i have a asp:LinkButton in aspx page and i just want that whenever user clicks on asp:LinkButton open popup on dat asp:LinkButton its already done and i have given another link to it(its ur website's link only) and its working fine,
but the problem is now i want to open a popup with checkboxes with the cities name.
i have made one type of you can say block in a DIV on the same aspx page in the bottom and now i want is to call this div content in the script above in windows.open..
Please help me out ..
asap
Thank You!
You can't show only piece of the current page using the window.open function - only the whole page.
Use ModulPopup from the AjaxControlToolkit or Dialog from the jQuery-UI or some similar functionality.
Or you can create new page that will contain only div with cities names checkboxes and open it via the window.open function