Q: 1.) Is this browser compatible?
Yes, for all browsers supporting jQuery data(). jQuery is generally supported by most modern browsers.
Q: 2) Are there any security concern to be aware of as compared to using wp_localize_script?
wp_localize_script() is mainly doing the same but it’s keeping the data on the serverside and not within the DOM.
As always, making use of javascript and interacting with the DOM has security implications. You need to follow the rules to properly en- and de-code any arbitrary data safely so that injections can not introduce unintended behaviour.
Related Posts:
- How to remove hardcoded characters from playlists?
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Understanding WordPress child theme custom JS loading
- Use different javascript files for each page on website
- Trigger popup in a php if/else statement
- How to prevent XSS alter custom global javascript object & methods in WordPress
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- Need Help Fixing My Iframes [closed]
- Menu jumping when calling it via PHP
- How to add API security keys into JS of wordpress securely
- wp_nav_menu not working correctly in my underscores theme
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- How to extend SelectControl with data from my theme
- $.ajax results in 403 forbidden
- register dependency css and js inside a plugin class
- Collapsible menu on post sidebar only expands and does not collapse
- How to send Ajax Call from frontend without using wp_localize_script in Theme
- Retrieve $_POST data to send to javascript without using localize script
- Function to return true if current page has child pages
- Combine CSS and JS files from plugins
- How to call a PHP function from Javascript in WordPress
- How to get the registered sidebar’s name by its id?
- is there a simple way to list every templates / php files used to generate a specific page?
- Security – Ajax and Nonce use [closed]
- Nice scroll to wordpress
- Dynamically loaded Theme components based on Customizer Settings values : changes not appearing in Customizer preview – (Workaround found)
- How to create filterable portfolio in WordPress?
- How do I list the_tags() into HTML data-attribute
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- Using Font Awesome as post thumbnail
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- admin-ajax.php responding with 0
- How can the plugin directory path be returned into ?
- Deregistering a script in WordPress seems impossible
- custom shortcode will not display the wrapped content
- How to prevent those PHP variables from being cached on WordPress?
- Show post in slider
- How can I use a modal window to display the current post in loops featured image?
- Using a variable in is_page(array())
- Anyway to output the registration form like the login form with wp_login_form()?
- Where to edit the template that is generating the code for dynamic_sidebar left-sidebar in the Understrap theme? [closed]
- get_the_tags() not iterating through for/while loop, but will with foreach
- How to pass aa JS variable to PHP?
- Image upload via FormData API and AJAX is not working ($_FILES always empty)
- post created but no permalink
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- wp attempt focus, disabling without touching core
- Is there a way to conditionally check whether a WordPress post title is empty?
- How to optimize the IF condition with many conditions and same output [closed]
- Use WordPress function in php file
- admin-ajax Firing Error 400 When Logged In
- Jquery window.send_to_editor function
- Why in my theme I can’t see all the statics content under the posts?
- Theme not calling Jquery properly
- How to add drag and drop functionalities to a div inside option panel
- how to prevent wordpress admin from logging in via woocommerce my-account page
- Double Curly Brackets in Php
- Get post categories
- How to change logo by category
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Output only links using wp_nav_menu()
- How to add aria role and schema markup to custom walker container
- jQuery accordion menu
- Run JS Code on userlog out
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Trying to change featured image from 180×180 to full width on home page
- Remove the Tag from wp_nav_menu
- PHP variables in a post?
- Code for unique user visit count on every page WordPress
- How to sort posts by active category in WordPress?
- Additional file upload in Gutenberg page options/featured image
- Display WordPress search results based on the selected Sub-Category
- Variation prices breakdown only for single product page
- How to add JS script in specific pages in WordPress?
- WordPress single.php get_header not working
- Load more posts using AJAX based on posts inside WP_Query
- How to use wp_ajax_set_post_thumbnail?
- Passing a value from an input field to a php function in WordPress?
- Unable to retrieve get_author_posts_url
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- Store user form submitted information in post type
- Using wp_editor() when not logged stopped working
- Modifying child theme’s header
- Show subcategory name selected in specific category woocoommerce
- WordPress files break if I edit them, but adding a closing PHP tag fixes it
- Move Jquery.js to Footer
- How can i iterate through this shortcode array?
- Not able to get the exact URL of the file on server located in active wordpress theme
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- add bootstrap modal after login in wordpress
- Help with my first Metabox helper class
- need help to arabic text in wordpress
- Add multiple JavaScript files to template header [duplicate]
- Add specific phrase after every product title including the discounted price? [closed]
- Trouble figuring out how to get my button to submit comment
- Using is home to get content [closed]
- How I can give a php page a style from my theme
- Woocommerce Convert existing order to the cart
- WordPress PHP8 Critical Error in class-wp-widget.php
- How can i add a script with parameters?