head中的<base target =“_ blank”/>不会在新标签页或新窗口

时间:2018-03-02 18:29:51

标签: html target base head

在此page on my website上,我需要在新标签/窗口中打开所有链接。我在<base target="_blank">中添加了<head>,并且工作了几天。今天突然它不再起作用..我也尝试添加这个脚本<script>$("body.page-template-plain a").attr("target","_blank");</script>,但这也不起作用。我希望有人可以提供帮助。

提前致谢!

3 个答案:

答案 0 :(得分:0)

&#34;问题是由于vc_gitem-link类不支持在新选项卡中打开链接。您可以将其定位为html自定义js以删除添加到其中的类。&#34;这是Visual Composer插件开发人员的答案。

答案 1 :(得分:0)

此脚本应该可以使用

let myLinks = document.querySelectorAll('a');

for (let link of myLinks) {
  link.setAttribute('target', '_blank');
}

示例:https://codepen.io/bbodine1/pen/YaPNvR/

答案 2 :(得分:0)

target =“ _ self”可能是链接中的问题:

 yarn run webpack`yarn run v1.22.4
warning package.json: No license field
$ yarn run sync && NODE_PATH=node_modules webpack --config vendor/akeneo/pim-community- 
dev/webpack.config.js --env=prod
warning package.json: No license field
$ NODE_PATH=node_modules node $npm_package_config_check --source=vendor/akeneo/pim- 
enterprise-dev
Error checking dependencies Invalid version: "3.0"
Starting webpack from /var/www/vhosts/akeneo/pim-enterprise-standard in prod mode

WebpackCleanupPlugin: 0 file(s) deleted.
Version: webpack 3.12.0
Time: 57399ms
          Asset       Size  Chunks                    Chunk Names
    main.min.js    1.53 MB       0  [emitted]  [big]  main
     lib.min.js     533 kB       1  [emitted]  [big]  lib
  vendor.min.js  701 bytes       2  [emitted]         vendor
manifest.min.js  845 bytes       3  [emitted]         manifest
main.min.js.map    4.05 MB       0  [emitted]         main
 lib.min.js.map    1.61 MB       1  [emitted]         lib
 vendor.min.js.map    1.76 kB       2  [emitted]         vendor
manifest.min.js.map    4.95 kB       3  [emitted]         manifest

ERROR in ./web/bundles/pimenterpriseui/js/filter/attribute/reference-entity-collection.js
Module not found: Error: Can't resolve 'akeneoreferenceentity/infrastructure/fetcher/record' 
in '/var/www/vhosts/akeneo/pim-enterprise- 
standard/web/bundles/pimenterpriseui/js/filter/attribute'
@ ./web/bundles/pimenterpriseui/js/filter/attribute/reference-entity-collection.js 1:314- 
 2715
@ ./web/js/module-registry.js
@ ./vendor/akeneo/pim-community-dev/webpack/require-context.js
@ ./web/bundles/pimui/js/form/builder.js
@ ./web/bundles/pimui/js/index.js
@ multi babel-polyfill ./web/bundles/pimui/js/index.js

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`