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
gateways(4)															       gateways(4)

NAME
gateways - configuration file for /usr/sbin/in.routed IPv4 network routing daemon SYNOPSIS
/etc/gateways The /etc/gateways file is used by the routing daemon, in.routed(1M). When the daemon starts, it reads /etc/gateways to find such distant gateways that cannot be located using only information from a routing socket, to discover if some of the local gateways are passive, and to obtain other parameters. The /etc/gateways file consists of a series of lines, each in one of the two formats shown below or consisting of parameters described later. Blank lines and lines starting with "#" are treated as comments. One format specifies networks: net Nname[/mask] gateway Gname metric value <passive | active | extern> The other format specifies hosts: host Hname gateway Gname metric value <passive | active | extern> Host hname is equivalent to net nname/32. The parameters in the lines shown above are described as follows: Nname or Hname Name of the destination network or host. It can be a symbolic network name or an Internet address specified in "dot" notation (see inet(3SOCKET)). If it is a name, then it must either be defined in /etc/networks or /etc/hosts, or a naming service must have been started before in.routed(1M). Mask An optional number between 1 and 32 indicating the netmask associated with Nname. Gname Name or address of the gateway to which RIP responses should be forwarded. Value The hop count to the destination host or network. passive | active | extern One of these keywords must be present to indicate whether the gateway should be treated as passive or active, or whether the gateway is external to the scope of the RIP protocol. A passive gateway is not expected to exchange routing information, while gateways marked active should be willing to exchange RIP packets. See in.routed(1M) for further details. After turning on debugging in in.routed with the -t option, you can see that lines that follow the format described above create pseudo- interfaces. To set parameters for remote or external interfaces, use a line starting with if=alias(Hname), if=remote(Hname), and so forth. For backward compatibility with the previous Solaris in.routed implementation, three special keyword formats are accepted. If present, these forms must each be on a separate line, and must not be combined on the same line with any of the keywords listed elsewhere in this document. These three forms are: norip ifname Disable all RIP processing on the specified interface. noripin ifname Disable the processing of received RIP responses on the specified interface. noripout ifname Disable RIP output on the specified interface. Lines that start with neither "net" nor "host" must consist of one or more of the following parameter settings, separated by commas or blanks: if=ifname Indicates that the other parameters on the line apply only to the interface name ifname. If this parameter is not specified, then other parameters on the line apply to all interfaces. subnet=nname[/mask][,metric] Advertises a route to network nname with mask mask and the supplied metric (default 1). This is useful for filling "holes" in CIDR allocations. This parameter must appear by itself on a line. The network number must specify a full, 32-bit value, as in 192.0.2.0 instead of 192.0.2. ripv1_mask=nname/mask1,mask2 Specifies that the netmask of the network of which nname/mask1 is a subnet should be mask2. For example, ripv1_mask=192.0.2.16/28,27 marks 192.0.2.16/28 as a subnet of 192.0.2.0/27 instead of 192.0.2.0/24. It is better to turn on RIPv2 instead of using this facility. See the description of ripv2_out, below. passwd=XXX[|KeyID[start|stop]] Specifies a RIPv2 cleartext password that will be included on all RIPv2 responses sent, and checked on all RIPv2 responses received. Any blanks, tab characters, commas, or "#", "|", or NULL characters in the password must be escaped with a backslash (). The common escape sequences , , , , and xxx have their usual meanings. The KeyID must be unique but is ignored for cleartext passwords. If present, start and stop are timestamps in the form year/month/day@hour:minute. They specify when the password is valid. The valid password with the longest future is used on output packets, unless all passwords have expired, in which case the password that expired most recently is used. If no passwords are valid yet, no password is output. Incoming packets can carry any password that is valid, will be valid within 24 hours, or that was valid within 24 hours. To protect password secrecy, the passwd settings are valid only in the /etc/gateways file and only when that file is readable only by UID 0. md5_passwd=XXX|KeyID[start|stop] Specifies a RIPv2 MD5 password. Except that a KeyID is required, this keyword is similar to passwd (described above). no_ag Turns off aggregation of subnets in RIPv1 and RIPv2 responses. no_host Turns off acceptance of host routes. no_super_ag Turns off aggregation of networks into supernets in RIPv2 responses. passive Marks the interface not to be advertised in updates sent over other interfaces, and turns off all RIP and router discovery through the interface. no_rip Disables all RIP processing on the specified interface. If no interfaces are allowed to process RIP packets, in.routed acts purely as a router discovery daemon. Note that turning off RIP without explicitly turning on router discovery advertisements with rdisc_adv or -s causes in.routed to act as a client router discovery daemon, which does not advertise. no_rip_mcast Causes RIPv2 packets to be broadcast instead of multicast. no_ripv1_in Causes RIPv1 received responses to be ignored. no_ripv2_in Causes RIPv2 received responses to be ignored. ripv2_out Turns on RIPv2 output and causes RIPv2 advertisements to be multicast when possible. ripv2 Equivalent to no_ripv1_in and ripv2_out. This enables RIPv2 and disables RIPv1. no_rdisc Disables the Internet Router Discovery Protocol. no_solicit Disables the transmission of Router Discovery Solicitations. send_solicit Specifies that Router Discovery solicitations should be sent, even on point-to-point links, which, by default, only listen to Router Discovery messages. no_rdisc_adv Disables the transmission of Router Discovery Advertisements. rdisc_adv Specifies that Router Discovery Advertisements should be sent, even on point-to-point links, which by default only listen to Router Discovery messages. bcast_rdisc Specifies that Router Discovery packets should be broadcast instead of multicast. rdisc_pref=N Sets the preference in Router Discovery Advertisements to the optionally signed integer N. The default preference is 0. Default routes with higher or less negative preferences are preferred by clients. rdisc_interval=N Sets the nominal interval with which Router Discovery Advertisements are transmitted to N seconds and their lifetime to 3*N. fake_default=metric Has an identical effect to -F net[/mask][=metric] with the network number and netmask coming from the specified interface. pm_rdisc Similar to fake_default. To prevent RIPv1 listeners from receiving RIPv2 routes when those routes are multicast, this feature causes a RIPv1 default route to be broadcast to RIPv1 listeners. Unless modified with fake_default, the default route is broadcast with a metric of 14. That serves as a "poor man's router discovery" protocol. trust_gateway=rtr_name[|net1/mask1|net2/mask2|...] Causes RIP packets from that router and other routers named in other trust_gateway keywords to be accepted, and packets from other routers to be ignored. If networks are specified, then routes to other networks will be ignored from that router. redirect_ok Causes RIP to allow ICMP Redirect messages when the system is acting as a router and forwarding packets. Otherwise, ICMP Redirect mes- sages are overridden. rip_neighbor=x.x.x.x By default, RIPv1 advertisements over point-to-point links are sent to the peer's address (255.255.255.255, if none is available), and RIPv2 advertisements are sent to either the RIP multicast address or the peer's address if no_rip_mcast is set. This option overrides those defaults and configures a specific address to use on the indicated interface. This can be used to set a "broadcast" type adver- tisement on a point-to-point link. in.routed(1M), route(1M), rtquery(1M), inet(3SOCKET), Internet Transport Protocols, XSIS 028112, Xerox System Integration Standard 1 Mar 2005 gateways(4)
All times are GMT -4. The time now is 05:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy