we have the problem with the router when we navigate from one to another page.
Suppose when we are in template1 and we need to go to templete2.Then we do Router.go(/templete2) right.I need in the URl templete1/templete2.Please help me.
try the following in your router.js file
Router.route('template1/template2',function() {
this.render('template2');
});
Related
For a project I am making I will be using a route that looks something like this: collection/id. The server returns an 404 error when the given ID does not exist.
When this happens I would like to push the 404 error page that I have in my router.
{
name: 'notfound',
path: '/:pathMatch(.*)*',
component: () => import('../views/PageNotFoundView.vue'),
}
Now this is achieved by calling the following code: this.$router.push('/notfound');. However, this also changes the URL in the browser which is not something I would want. When reloading the page you should be going to collection/id.
Is there any way to push a navigation route (or component?) without changing the URL displayed?
Example: https://google.com/ajdfkasf doesn't go to https://google.com/404 but rather you keep the link and can refresh it. I could include the component in the view instead of trying to solve this with routes, but that would add overhead to all kinds of views.
Here is the url in browser i want to change tu.edu.pk/#kingster-moblie-menu to tu.edu.pk/#tu-moblie-menu
Please Hepl me out how to reslove this issue.
You can try this js on your js file
// Replaces the location of the current window with the new one.
window.location.replace("https://www.tu.edu.pk/#tu-moblie-menu");
Some random has purchased a .com domain and I own .net. he has posted an iframe on the site linking to mine, and at the top of if he has posted that "This site is for sale" and I need to stop this happening. is it possible to use PHP or javascript to stop that particular site from either accessing my site, or redirecting his iframe to somewhere else.
Thats easy:
Say he use your file this way
a.html
<html>
<body>
<iframe src="sample.html"/>
</html>
just add the following lines to your already existing on Document load function:
window.onload = function(e) {
if ( window.self !== window.top ) {
//Your site is in i frame
//just redirect to his own site if you feel like there will be an endless recursion so nothing will load probably.
//You can put your custom action if this is not what you want
window.self.location = "a.html"
//would be pretty good enough :D
}
};
Iron Router pathFor does not work when looking for route '/' or ''.
I'm trying to create a link to homepage here but it does not seem to accept that route. Routing is set properly and works properly by entering it.
Is there a special pathFor for homepages?
You should pass the name of the route as the parameter. Take a look at here
if #user3594721 make spacebars
{{pathFor "/"}}
it is wrong, and check inside Router method. also you don't have route for homepage (or root page), make route for homepage
change
{{pathFor "/"}}
to
{{pathFor "something you typed name of homepage"}}
I 've created a website www.milan-kresojevic.com.Everything is fine and now installed wordpress blog plugin to my server and started building a blog to.You can notice that when you come to the main menu on this website,and right click on the "Blog" button,you can open it in new window so the link seems to be working.BUT...
When you left-click on in as every normal link- it doesn't work :/
This is a bit confusing,and I've tried changing it in a zillion ways,and it is still the same.
Right-click "open in a new window" works,and left-click doesnt :(
Does anybody have an idea how should I change it?
Thanks in advance...
:)
SOLVED!Like this:
Ok,I ma going to show you what I did,so that this post might actually help someone else :)
My HTML nav code was this:
http://imageshack.com/a/img850/4371/40g8.png
So I listened to the nice man above me :)
And did this with the github source:
add the imageshack url in front of this I can not post 2 links as a new user :/a/img850/6605/uxs5.png
Found this on the github and my regular jquery.nav.js with this right here :https://github.com/davist11/jQuery-One-Page-Nav,
and added some JS code at the bottom of my page :
$(document).ready(function() {
$('#nav').onePageNav({
filter: ':not(.external)',
});
});
And that was it :) All works now,and I hope this is detailed enough to help someone else :)
your problem is the jquery.nav plugin. which expects only links linking to anchors on the page. try adding the class 'external' to the specific items and it should open the link as expected.