vue-hackernews-2.0
vue-hackernews-2.0 copied to clipboard
3rd party fails to load on second pageload
Hi @yyx990803
Some service integrations require an embedded script inside the vue instance. This is per default not allowed, but with packages like vue-script2
it is possible - however.
Integrating a third party script inside the vue instance will only allow it to load on the first page load both SSR loaded and CSR. The only way I have found to hack this issue is to apply some information about the current page contains a "unsupported" script and force a SSR by window.location.replace
in the beforeRouteUpdate
navigation guard.
Is there a way to implement third party scripts provided by some companies, that will load every time?
I have used the following as a base for testing in both in Vue CLI and Vue-Hackernews 2.0 boilerplate.
<div data-widget-url="https://septima.dk/widget/config/layer.json"></div>
<script src="https://widgetconfig.septima.dk/widgetconfig.js"></script>
This perticular case can be hacked but the issue still prevails if only a script-tag is provided which has to be placed in context.
I personally see this as a missing part of Vue if my case is unsupported.
Cheers