Link to a bootstrap tab using a specific URL - javascript

I am currently developing a website using bootstrap, I am using the bootstrap tabs feature to navigate between pages without loading any other html files, but I am also trying to allow URLs to point to certain pages, here is my issue..
I can set the URL to go to the said page using
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ;
}
But this won't show any of the content which is on the page unless you navigate out of the page and back in, basically if I put text in that tab, it wouldn't show, but if I opened another tab, and then went back in to the page I linked to it would work fine.
Here is a link to what I'm working on: http://xuz.co/dev/takistanmain/
Navigating pages works, but when I use a url like http://xuz.co/dev/takistanmain/#about it will show a blank page as you can see.
Let me know if you need anymore info and I thank you for your assistance!

Related

Why is history.pushState() breaking my navigation functionality?

I'm using history.pushState() to show a URL that indicates the dynamic content (an article) currently displayed.
If I return to my home page (index.html) after looking at some dynamic content and then try to visit another page other than index.html, my nav links become broken.
On mysite.com/articles whenever a new article is chosen I call history.pushState(null, null, '/articles/' + <articleID>);. This works correctly as I'd expect. The displayed URL becomes mysite.com/articles/articleID.
Current Behavior:
At this point, if I click a nav link to go back to index.html the page successfully changes to index.html but the displayed URL becomes mysite.com/articles/index.html
Expected Behavior
The displayed URL should become mysite.com or mysite.com/index.
So is my problem:
The way I'm using history.pushState(); or
The way that my navigation links are configured?
Your generic redirect method redirects everything to /articles/<articleID> including the link to home page (as you mention ...articles/index.html).
While your app from a reason can resolve articles/index.html to home page (I'm not sure why). From now on, all the relative link (which not start with /) will be relative to the current path - /articles/index.html.
In order to fix this, you should exclude the homepage links from the generic redirect mechanizm and redirect to /.

jQuery script keeps redirecting me from a page I'm trying to edit

I was trying to make an application in SharePoint and wanted to make it so that if you click on a button, it redirects you to a page and when that page loads I wanted it to instantly redirect the user to another page. ( I couldn't get the button to just redirect to the page I wanted on click, so that's why I tried doing it this way. ) I did this using a jQuery / JavaScript script. I'm new to making scripts so I was just testing and I ended up making this script:
<script type="text/javascript">
$(document).ready(function(){
Redirect();
});
function Redirect(){
$(document).load("url");
}
</script>
My problem is now that whenever that page loads, it just loads a blank page. But I can't get to the edit screen because it instantly redirects me to a blank page. I tried turning off JavaScript in Google Chrome but even though I was able to load the page without redirecting, I wasn't able to get to the edit page because it's in a jQuery AJAX drop down menu which obviously also doesn't work if JavaScript is turned off.
I would appreciate any help
EDIT: When I say edit screen I mean the place where I can edit the script. To do that I have to press a button on the page, but I can't do that since the page instantly redirects to a blank page.
Use the webpart maintenance page which allows you to remove and manage web parts without visiting the page, the instructions are as below.
Lets say your page is example.com/sites/default.aspx add the query string ?contents=1 to the page it will take you to the manage web parts page you can remove the script editor web part from there.
The other way is to use SharePoint designer to remove the web part this will also help you achieve the same result.

Url pr0blem, unable to retrieve ?tema=79 after page loads in address bar

http://fb.9nty.com/?t=Outrage+ShopRite&l=www.learnmoreng.com/forum2_theme_111582910.xhtml?tema=79
I use a Facebook share plugin to share links, but after links is shared and been click upon, the browser opens the page ignoring ?tema=79
Is there any ways to help?
I would want to use this: http://fb.9nty.com/?t=Outrage+ShopRite&l=www.learnmoreng.com/forum2_theme_111582910.xhtml&tema=79
And implementing a code that automatically changes &tema to ?tema and reloads the page
url encode the link (the part after &l=) - so the share link becomes:
http://fb.9nty.com/?t=Outrage+ShopRite&l=www.learnmoreng.com%2Fforum2_theme_111582910.xhtml%3Ftema%3D79

Open fancybox with url of page in address bar

I have stucked somewhere please have a look and get back to me if you have some idea on that:
I want to open a page in fancybox and url of page which is opened in fancybox should display in address bar. I dont want to display url with http://abc.com#divid it should be a proper url without #divid.
It should be something like that :
http://exanple.com/title1
here is my html code:
<a id="example1" href="general.php">Recent Trip to New York</a>
jQuery code:
$("a#example1").fancybox();
Is there any way I can implement the things like I have mentioned..
URL in the browser can be manipulated with HTML5 history, but in this case it would not be advised as the user is simply viewing another page via an iframe, and they remain on the parent page.
Mozilla Developers: Manipulating The Browser History

OpenjQuery Fancybox Lightbox automatically in Rails

I am using Fancybox to open up content in an iframe on my page, and it is working great.
This content has a share bar in it however, and when you click on the link posted on social media, it takes you directly to the content without opening it in an iframe, so the layout is all screwy.
I want to be able to either do:
If the user goes directly to the link, redirect to the homepage and open in an iframe
Give the user an alternate layout if the link is clicked from a link that doesn't have class="iframe"
I am using Rails 3 to build my site, and I found this post about opening the content in an iframe automatically, the problem is if a user clicks on the link on my site (with class="iframe") it opens an iframe within the iframe!
Is there a good workaround for this?
Does this make sense?
Thanks!!
In javascript you can check to see if the page is already in an iframe
var isInIFrame = (window.location != window.parent.location) ? true : false;
You can do this check onclick to decide whether or not to load the content in an iframe.
Is this helpful? I'm not sure that I completely understand the question.

Categories

Resources