I'm working with jquery load, which has to navigate from index.html page to container.html.
index.html page jquery code looks like this
$(".tblList a").click(function () {
var aUrl = $(this).attr("href");
var page = aUrl.split("?page=");
localStorage.setItem("pageName", page[1]); }); //click end
in container.html page my html and jquery code looks like this:
html:
<div id="containerWrapper" class="row"></div>
js:
$(function () {
var pageName = localStorage.getItem("pageName");
$("#containerWrapper").load(pageName + ".html");
$("#containerWrapper").find('a[href^="http"]').click(function () {
alert("http");
window.open(this.href);
return false;
//$('#containerWrapper').load($(this).attr("href"));
});
$('a[href^="ftp"]').click(function () {
alert("ftp");
$(this).attr("target", "_blank");
}); });
$(window).bind('hashchange', function (e) {
var url = window.location.toString();
var innerPagesLink = url.split("?page=")[0];
var innerPagesLinkUrl = url.split("#")[1];
var result = innerPagesLink + "#" + innerPagesLinkUrl;
var replaceUrl = url.replace("?page=", "#");
//alert(innerPagesLink); return false;
window.location = innerPagesLink;
newHash = window.location.hash.substr(1);
$mainContent.load(newHash);
}); //bind end
what is solved is:
- i am successfully loading page from index.html hyperlink to container.html div id.
in container.html (loaded page) have many hyperlinks some with attributes like:
a href="someother.html"
a href="http://someother.com"
a href="ftp://someother.com"
I am successfully loading "a href *.html" hyperlinks to div#containerWrapper.
I fail to load http and ftp external pages to my div.
I tried to open http or ftp links to other tab which also fails me. attached here are two pages with example fiddles:
(these fiddles are not working in online which works in local mc)
pls try to help me out and sorry for my english.