I'm trying to open a link in a new tab using JavaScript, however, I am having some issues. The link is to a record in CRM and the error I receive is:
'Input string was not in correct format.'
Here is what my URL looks like:
https://companyname.com/crm/main.aspx?etc=112&extraqs=%3f_gridType%3d112%26etc%3d112%26id%3d%257b240F22C7-A795-E311-83F6-00155D01A312%257d%26pagemode%3diframe%26preloadcache%3d1392415527562%26rskey%3d228507345&pagetype=entityrecord
This works by opening the link in the current tab:
<p><a href="https://companyname.com/crm/main.aspx?etc=112&extraqs=%3f_gridType%3d112%26etc%3d112%26id%3d%257b240F22C7-A795-E311-83F6-00155D01A312%257d%26pagemode%3diframe%26preloadcache%3d1392415527562%26rskey%3d228507345&pagetype=entityrecord"> Click this link! </a></p>
But this does not work:
<p><a href="javascript:void(window.open('https://companyname.com/crm/main.aspx?etc=112&extraqs=%3f_gridType%3d112%26etc%3d112%26id%3d%257b240F22C7-A795-E311-83F6-00155D01A312%257d%26pagemode%3diframe%26preloadcache%3d1392415527562%26rskey%3d228507345&pagetype=entityrecord'));"> Click me too!</a></p>
^ This one is the one which returns the 'Input string...' error.
I'm not sure what I'm doing wrong here, so any input is greatly appreciated!
Thanks!
You open page in a new tab by adding target="_blank"
in your link. You are using window.open, which is for a pop-up, not a new tab.
<a href="..." target="_blank"> ... </a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.