Sponsored Content
Top Forums Web Development Simple Vue.js Component to Redirect to External Web Page Using Vue Router Post 303031806 by Neo on Wednesday 6th of March 2019 04:18:33 AM
Old 03-06-2019
Simple Vue.js Component to Redirect to External Web Page Using Vue Router

Vue Router has some quirks and on of the quirks is that it is not reliable when adding external links using the vue-router library.

After struggling with many solutions, I have found that creating a simple Vue.js component like this one seems to work the best (so far):

Component Example: RedirectNotes.vue

Code:
<template>
  <div class="d-flex justify-content-around" style="padding:20px" v-if="redirect()">
    <div>
      <h3>This Vue Component Does a Basic Redirect</h3>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    redirect() {
      var url = "https://www.unix.com/usernote.php";
      this.$router.push({ path: "/dashboard" });
      window.open(url, "_target");
    }
  }
};
</script>

<style>
</style>

Naturally the entries is routes.js are simple:

Code:
const RedirectNotes = () => import("src/pages/vB/RedirectNotes.vue");

Code:
   
       {
        path: "usernotes",
        name: "User Notes",
        components: { default: RedirectNotes }
      },

This is not the best method, but it is the only method that works consistently in vue-router so far.

The downside is that some browsers may block the new window and the user will need to grant permissions.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to redirect to a web-page by shell script

Dear all, I am calling a korn shell script(CGI script) by a web-page. This shell script do some checking in a unix file and return true or false. Now within the same script, If it returns true then I want to redirect to another web-page stored in htdocs directory. Example: Login page sends a... (3 Replies)
Discussion started by: ravi18s
3 Replies

2. Web Development

A Simple Way to Set Meta Tags Using Vue.js

Did a lot of searching on the net and found a lot of tricky ways and Vue.js libs to set meta tags, but I wanted sometime simpler. So, given this standard HTML: <head> <title>Page Title</title> <meta name="description" content="Page Description"> <meta name="keywords" content="Page... (0 Replies)
Discussion started by: Neo
0 Replies

3. Web Development

A simple UNIXtime component in Vue.js

A shout out to Scott who gave me a helping hand to turn a simple sample Vue.js app I wrote yesterday into a Vue.js component: Vue.component("unix-time", { template: `<div class="time">{{unixtime}}</div>`, data() { return { unixtime: "" }; }, methods: { ... (1 Reply)
Discussion started by: Neo
1 Replies

4. Web Development

Some Thoughts on Vue.js at UNIX.com

Recently, have been learning Vue and, as always, learning-by-doing, which means writing code for real-world applications. In this process, I have learned something that is not really mentioned in the majority of online Vue tutorials. Basically, when you create a Vue instance in your browser,... (0 Replies)
Discussion started by: Neo
0 Replies

5. Web Development

MySQL Query to Build Mockup Vue.js UserCP Timeline Page

Here is the query (and some sample results) I plan to use to build a new timeline page in the mockup vue.js usercp I am working on. When the postid is the same as lastpostid, this means the timeline entry will be - "{{Member}} Started Discussion {{Thread Title}} at {{date and time}}" and when... (4 Replies)
Discussion started by: Neo
4 Replies

6. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series: ... (0 Replies)
Discussion started by: Neo
0 Replies

7. Web Development

Vue.js Steam Chat

This Vue.js chat component installed easily: npm i --save vue-steam-chat I was able to set it up and change the background color in the component css file to match the forums in seconds: https://www.unix.com/members/1-albums225-picture1162.png <template> <div style="height: 600px;... (17 Replies)
Discussion started by: Neo
17 Replies

8. Web Development

Web development learning thread(Javascript, HTML, CSS, angular, vue.js).

Hello All, After getting inspired from Neo, I have started a bit of JS learning these days. Whenever I learn something I will try to post it here(as of now my learning is NOT exactly bookish where I am going chapter by chapter etc, it could be more like small-small project vice kind of), I... (25 Replies)
Discussion started by: RavinderSingh13
25 Replies

9. Web Development

The State of Vue.js

Here is very good video from Evan You, founder of Vue.js, on the state of Vue.js State of Vuenation with Evan You Here is a nice PDF report on Vue.js Update State of Vue.js Report Vue.js is now the second most starred project on GitHub, recently surpassing Bootstrap. These two... (0 Replies)
Discussion started by: Neo
0 Replies

10. Web Development

Vue.js component: Beautiful code highlighter

Sooner than later I will render forum discussions in Vue.js to complement the standard way of showing forum threads. Today, I ran across this component, vue-code-highlight Beautiful code syntax highlighting as Vue.js component. https://www.unix.com/members/1-albums225-picture1199.jpg ... (1 Reply)
Discussion started by: Neo
1 Replies
RTADVD(8)						    BSD System Manager's Manual 						 RTADVD(8)

NAME
rtadvd -- router advertisement daemon SYNOPSIS
rtadvd [-dDfMRs] [-c configfile] interface ... DESCRIPTION
rtadvd sends router advertisement packets to the specified interfaces. The program will daemonize itself on invocation. It will then send router advertisement packets periodically, as well as in response to router solicitation messages sent by end hosts. Router advertisements can be configured on a per-interface basis, as described in rtadvd.conf(5). If there is no configuration file entry for an interface, or if the configuration file does not exist altogether, rtadvd sets all the parame- ters to their default values. In particular, rtadvd reads all the interface routes from the routing table and advertises them as on-link prefixes. rtadvd also watches the routing table. By default, if an interface direct route is added/deleted on an advertising interface and no static prefixes are specified by the configuration file, rtadvd adds/deletes the corresponding prefix to/from its advertising list, respectively. The -s option may be used to disable this behavior. Moreover, if the status of an advertising interface changes, rtadvd will start or stop sending router advertisements according to the latest status. Basically, hosts MUST NOT send Router Advertisement messages at any time (RFC 2461, Section 6.2.3). However, it would sometimes be useful to allow hosts to advertise some parameters such as prefix information and link MTU. Thus, rtadvd can be invoked if router lifetime is explic- itly set zero on every advertising interface. The command line options are: -c Specify an alternate location, configfile, for the configuration file. By default, /etc/rtadvd.conf is used. -d Print debugging information. -D Even more debugging information is printed. -f Foreground mode (useful when debugging). -M Specify an interface to join the all-routers site-local multicast group. By default, rtadvd tries to join the first advertising interface appeared in the command line. This option has meaning only with the -R option, which enables routing renumbering protocol support. -R Accept router renumbering requests. If you enable it, certain IPsec setup is suggested for security reasons. On KAME-based systems, rrenumd(8) generates router renumbering request packets. This option is currently disabled, and is ignored by rtadvd with a warning message. -s Do not add or delete prefixes dynamically. Only statically configured prefixes, if any, will be advertised. Upon receipt of signal SIGUSR1, rtadvd will dump the current internal state into /var/run/rtadvd.dump. Use SIGTERM to kill rtadvd gracefully. In this case, rtadvd will transmit router advertisement with router lifetime 0 to all the interfaces (in accordance with RFC2461 6.2.5). DIAGNOSTICS
The rtadvd utility exits 0 on success, and >0 if an error occurs. FILES
/etc/rtadvd.conf The default configuration file. /var/run/rtadvd.pid contains the pid of the currently running rtadvd. /var/run/rtadvd.dump in which rtadvd dumps its internal state. SEE ALSO
rtadvd.conf(5), rrenumd(8), rtsol(8) HISTORY
The rtadvd command first appeared in WIDE Hydrangea IPv6 protocol stack kit. CAVEAT
There used to be some text that recommended users not to let rtadvd advertise Router Advertisement messages on an upstream link to avoid undesirable icmp6(4) redirect messages. However, based on the later discussion in the IETF ipng working group, all routers should rather advertise the messages regardless of the network topology, in order to ensure reachability. BSD
May 17, 1998 BSD
All times are GMT -4. The time now is 02:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy